Skip to content

Conversation

@sunsided
Copy link

@sunsided sunsided commented Jul 19, 2025

This pull request introduces improvements to the signature verification logic and adds a new test to ensure proper handling of multiple algorithms during token decoding.

To be clear: If the purpose is to ensure that a single validator always has to have the same family of algorithms, then this PR is invalid. :)

Improvements to signature verification logic:

  • src/decoding.rs: Simplified the validate_signature block by replacing the loop with a more concise any iterator to check if the key's family matches any of the allowed algorithms. This resolves a bug where the validation would fail if the family of the first entry in the supported algorithms array mismatches with the key, even if another algorithm would match.

Expanded test coverage:

  • tests/hmac.rs: Added a new test, decode_token_multiple_algorithms, to verify that decoding works correctly when multiple algorithms are specified in the validation object. This ensures compatibility with tokens signed using different algorithms.
@sunsided sunsided closed this Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant