Repository navigation
fix: refuse caller JSON whose members conflict before it is signed or sent - #1007
Merged
Merged
Conversation
GrantedAuthorization.IDTokenClaims values are raw JSON, and
validateGrantedIDTokenClaims did not look inside them for repeated
member names. Since every JWT claims parser here refuses a claims set
that repeats a member with differing copies, or as a case variant, at
any depth, the server could issue an ID token its own client refuses,
and that other readers decode differently (one keeping the first copy,
another the last). The nightly fuzz job found it with {"":0,"":1}.
Add strictjson.CheckConflictingObject, which applies
CheckConflictingMembers to an object given as its members, names the
member at fault, and also refuses two names that differ only in case.
Use it in:
- validateGrantedIDTokenClaims, so CompleteAuthorization and
CompleteBackchannelAuthentication refuse such claims with
invalid_request;
- token.IssueIDToken and IssueAccessToken, so a value only known at
the token endpoint (an IdentityClaimsSource's, or one in a grant
stored earlier) fails as server_error instead of being signed;
- SignUserInfoResponse, which refuses such claims as server_error.
A plain "claims" parameter at PAR or the backchannel endpoint that
repeats a member with differing copies, or as a case variant, is now
invalid_request, as a request object carrying it already was: the
values it requests are carried into the access token.
The fuzz input is added to the FuzzGrantedIDTokenClaims corpus.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
UserInfoClaims copied each value its IdentityClaimsSource returned into
the UserInfo response unchecked. A value repeating a member with
differing copies, or as a case variant, at any depth, or a requested
claim named as a case variant of another ("Sub" beside the "sub" it
sets), made a response this module's client refuses and other readers
decode differently. UserInfoClaims now returns an error for one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ResolveIssuer.Response signed ResolvedEntity.Metadata as given. A Resolver's own resolution never repeats a member, but a hand-built ResolvedEntity could, and a Resolve Response repeating a member with differing copies, or as a case variant, at any depth is refused by its readers, this module's included, and read differently by others. Response now refuses such metadata, as filtered to the requested Entity Types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BeginAuthorization, BeginBackchannelAuthentication and RequestClientCredentialsToken sent the caller's AuthorizationDetails entries as given. An entry repeating a member name, or holding two that differ only in case, is read differently by different authorization servers, and a FAPIgo server refuses any such repeat in authorization_details, identical copies included, as this client does in a token response. Each call now refuses one as invalid_request before anything is sent. requestobject.Create also refuses parameters its own parser would refuse once signed in: a value repeating a member with differing copies, or as a case variant, and a name that differs only in case from another parameter or from a claim Create sets, such as an extension value named "Scope". The request then fails instead of carrying an object the authorization server refuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the v0.88.1 UPGRADING.md section listing each call that now refuses a value repeating a member with differing copies, or as a case variant, and what to change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each new refusal of a value repeating a member with differing copies, or as a case variant, gets a mutant disabling it, killed by the test added with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CheckConflictingObject wraps each value in "[...]" to check it at the readers' depth. It sized that buffer as len(value)+2, an addition CodeQL flags as a possible overflow in an allocation; slices.Concat builds the same bytes. The mutant that drops the wrapping is re-anchored on the new line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.



This fixes a gap that the nightly fuzz job found (
FuzzGrantedIDTokenClaims, run 45867999580), and seven more places where the same class of issue could reach a signed or sent document.The finding
Since #995 (v0.87.0, audit E-10), FAPIgo's JWT parsers refuse a claims set that repeats a member with differing values, at any depth. An embedder's
GrantedAuthorization.IDTokenClaimsvalues are raw JSON, andvalidateGrantedIDTokenClaimsdidn't look inside them. So the server accepted a value such as{"":0,"":1}and issued an ID token that FAPIgo's own client refuses. Third-party readers would also decode that token differently: E-10's differential, created by the issuer.Fixes
A new internal
strictjson.CheckConflictingObjectchecks an object's members and each value to the depth the readers use. It refuses repeats with differing values and case-variant names, and returns the claim at fault.GrantedAuthorization.IDTokenClaimsatCompleteAuthorization/CompleteBackchannelAuthenticationinvalid_request, naming the claim. Two claim names differing only in case are refused too.IdentityClaimsSourcevalues merged at the token endpointtoken.IssueIDToken/IssueAccessTokennow check before signing, so the token request fails asserver_error, as an over-budget token does. This also catches grants stored before this release.server.SignUserInfoResponseclaimsserver_errorserverresource.UserInfoClaimsSubclaim alongside thesubthe function sets.claimsparameter at PAR / CIBAinvalid_request, as a request object carrying it already was. This was reachable from client input, since requested values were copied into the JWT access token, which FAPIgo's own RS then refused.federation.ResolveIssuer.Responsewith hand-built metadataAuthorizationDetailsatBeginAuthorization,BeginBackchannelAuthenticationandRequestClientCredentialsTokenrequestobject.CreateparametersScanned and not reachable:
intfed.Create's check before signing.UPGRADING.md has a section under v0.88.1 listing each new refusal.
Wire protocol
For valid inputs, no token or document changes. The one client-visible change is that a plain-form
claimsparameter at PAR or CIBA that repeats a member with differing values, or as a case variant, now gets 400invalid_request. Conformance and all four interop suites are running.Tests
FuzzGrantedIDTokenClaimscorpus.FuzzGrantedIDTokenClaimspassed a 120 s run. Seven related targets passed 60 s each: the parsers for claims, ID tokens, access tokens, request objects, resource requests and authorization responses.🤖 Generated with Claude Code