Skip to content

fix: refuse caller JSON whose members conflict before it is signed or sent - #1007

Merged
osanderson merged 9 commits into
mainfrom
fix/embedder-json-conflicting-members
Nov 27, 2026
Merged

osanderson merged 9 commits into
mainfrom
fix/embedder-json-conflicting-members

Conversation

@osanderson

Copy link
Copy Markdown
Collaborator

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.IDTokenClaims values are raw JSON, and validateGrantedIDTokenClaims didn'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.CheckConflictingObject checks 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.

Where caller JSON entered Now
GrantedAuthorization.IDTokenClaims at CompleteAuthorization / CompleteBackchannelAuthentication refused as invalid_request, naming the claim. Two claim names differing only in case are refused too.
IdentityClaimsSource values merged at the token endpoint token.IssueIDToken/IssueAccessToken now check before signing, so the token request fails as server_error, as an over-budget token does. This also catches grants stored before this release.
server.SignUserInfoResponse claims refused as server_error
serverresource.UserInfoClaims returns an error. This was reachable without crafted values: a source returning a Sub claim alongside the sub the function sets.
A plain-form claims parameter at PAR / CIBA refused as invalid_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.Response with hand-built metadata refused
Client AuthorizationDetails at BeginAuthorization, BeginBackchannelAuthentication and RequestClientCredentialsToken refused before sending. Any repeat is refused, matching FAPIgo's AS and the client's own token-response decoder.
requestobject.Create parameters a check before signing refuses to sign a request object FAPIgo's AS would refuse

Scanned and not reachable:

  • Already strict: RAR grants and extension parameters are checked by their registries. Federation Entity Configurations and Subordinate Statements are checked by intfed.Create's check before signing.
  • Built by the library: JARM and AS metadata are built by the library from typed values.
  • Typed, with no extra-claims field: client assertions, DPoP proofs and attestation PoPs.
  • Not served: the resource package signs nothing.

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 claims parameter at PAR or CIBA that repeats a member with differing values, or as a case variant, now gets 400 invalid_request. Conformance and all four interop suites are running.

Tests

  • Coverage: unit tests for each refusal, a fuzz target for the new check, and the fuzz job's failing input in the FuzzGrantedIDTokenClaims corpus.
  • Mutants: 15 new, each disabling one check, all killed.
  • Suites: the race suite, sqlstore, every example module and the interop client pass, and lint is clean.
  • Fuzzing: FuzzGrantedIDTokenClaims passed 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

osanderson and others added 6 commits November 27, 2026 19:36
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>
osanderson and others added 2 commits November 27, 2026 19:45
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

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.58824% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/requestobject/create.go 90.32% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@osanderson
osanderson merged commit 74101db into main Nov 27, 2026
34 checks passed
@osanderson
osanderson deleted the fix/embedder-json-conflicting-members branch November 27, 2026 13:14
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.

2 participants