[MEDIUM] Fix unencoded payload verification state and crit handling - #753
Open
OskarEichler wants to merge 1 commit into
Open
[MEDIUM] Fix unencoded payload verification state and crit handling#753OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
OskarEichler
force-pushed
the
codex/security-preserve-claims-verification-state
branch
from
September 4, 2026 16:30
df45188 to
719797f
Compare
OskarEichler
force-pushed
the
codex/security-preserve-claims-verification-state
branch
from
September 4, 2026 16:31
719797f to
d8b32e4
Compare
anakinj
reviewed
Sep 5, 2026
anakinj
left a comment
Member
There was a problem hiding this comment.
There are no specs to ensure the behavior of the strict flag or the changed behavior of the unencoded_payload
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.
Summary
Corrects two verification gaps in the
b64: falsepayload path: decoding no longer marks all JWT claims as verified, and unsupported critical JOSE extensions are rejected. This addresses the highest-priority open verification-state finding in #723 and enforces RFC 7515 section 4.1.11.Problem
unverified_payloadinvokesdecode_payload. For unencoded payloads, that method calledverify_claims!(crit: ['b64']), which set the shared@claims_verifiedflag after checking only the protected-header requirement.After a valid signature check, this sequence allowed
payloadto return an expired payload without an explicit claim verification call:The normal
JWT.decodepath is not affected.The same internal path also accepted tokens whose
critarray contained unknown extensions. RFC 7515 requires implementations to reject a JWS when any listed critical extension is not understood and supported.Fix
Invoke the
Claims::Critverifier directly through the existing claims context. This preserves the internalb64header check without changing the general claims-verification state. A backward-compatiblestrictoption rejects any critical extensions outside the explicitly supported set for this internal path.Verification
payload_after_unverified=BYPASSJWT::DecodeErroruntil explicit claim verificationverify_claims!JWT::InvalidCritErrorbundle exec rspecon Ruby 4.0.6: 557 examples, 0 failures, 12 expected pendingbundle exec rspecon Ruby 3.2.11: 557 examples, 0 failures, 12 expected pendingbundle exec rubocop lib/jwt/claims/crit.rb lib/jwt/encoded_token.rb: no offensesgem build ruby-jwt.gemspec: successfulNo test files are included in this focused patch. The behavior was verified with an external reproduction plus the complete existing suite.
Compatibility
No public API or successful verification behavior changes. No breaking change intended.