auth: bind JWT verification to typed policy#52
Merged
Conversation
Replace runtime JOSE algorithm selectors with a verifier-owned enum so peer metadata can only assert, never select, the RSA signature profile. Remove the compatibility helpers and cover canonical mismatches, profile confusion, zero-allocation scratch use, and fuzz paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
RsaJwtAlgorithm, a closed typed set of the six supported RSA JOSE algorithms.RsaJwtVerifier, bound to one public key and one locally selected algorithm.algmetadata as an exact assertion; it can no longer select an RSA profile.Why this shape
The old API could represent policy as independently coordinated strings and a generic signature profile. The new boundary derives the canonical JOSE name and RSA profile from one verifier-owned enum value, so inconsistent policy states are unrepresentable and peer metadata cannot widen local policy.
This remains an RSA primitive boundary, not a partial JOSE parser. Providers still own strict JSON, UTF-8, base64url, compact serialization, duplicate-member, and critical-header validation before passing one decoded protected-header
algassertion.This is an intentional pre-v1 API break. The following compatibility/string selector methods are removed rather than deprecated or shimmed:
RsaSignatureProfile::{from_jwt_alg,matches_jwt_alg}RsaPrivateKey::{sign_jwt_alg,sign_jwt_alg_with_scratch}RsaPublicKey::{verify_expected_jwt_alg,verify_expected_jwt_alg_with_scratch}RsaPublicKey::{verify_jwt_alg,verify_jwt_alg_with_scratch}No dependency, unsafe-code, RSA arithmetic, padding, or backend changes are included.
Validation
just check-all rscryptojust test --alljust test-fuzz auth_rsa_protocol 15