Skip to content

Signature: Accept signatures with hs2019 algorithm #1814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 19, 2025

Conversation

obenland
Copy link
Member

Follow-up to #1803 and depends on it for all tests to pass.

Proposed changes:

  • Update get_signature_algorithm to check for hs2019 to identify algorithm.
  • Add tests.

Other information:

  • Have you written new tests for your changes, if applicable?

Testing instructions:

  • The unit test should have it covered? 🤞

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

HTTP signatures using the hs2019 algorithm now get accepted without error.

@obenland obenland marked this pull request as ready for review June 13, 2025 20:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the hs2019 HTTP signature algorithm, updates the signature detection logic, and includes new tests plus a changelog entry.

  • Introduce hs2019 case in get_signature_algorithm mapping to sha512
  • Add unit tests for signature algorithm detection and full HTTP signature verification with hs2019
  • Include a changelog entry for the new fix

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/includes/class-test-signature.php New data provider and tests for get_signature_algorithm and end-to-end hs2019 verification
includes/class-signature.php Updated get_signature_algorithm to recognize hs2019
.github/changelog/1814-from-description Added changelog entry for the hs2019 signature fix
Comments suppressed due to low confidence (2)

includes/class-signature.php:356

  • Accessing $signature_block['algorithm'] without checking if the key exists can trigger a PHP notice for undefined index. Wrap it in isset() or use ! empty() to safely guard against missing keys.
if ( $signature_block['algorithm'] ) {

includes/class-signature.php:359

  • The previous support for 'rsa-sha-512' was removed in this switch, causing that algorithm to fallback to the default 'sha256'. Consider re-adding a case 'rsa-sha-512': return 'sha512'; if you still intend to support it.
case 'hs2019':

@obenland
Copy link
Member Author

@mediaformat It looks like I can't add you to the list of reviewers—would you still be able to give this a look and share any feedback you have?

@obenland obenland requested a review from pfefferle June 19, 2025 16:52
@obenland obenland merged commit 9e18148 into trunk Jun 19, 2025
11 checks passed
@obenland obenland deleted the fix/signature-variables branch June 19, 2025 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants