Repository navigation
fix: send authorization_details unescaped from the client; refuse typed-nil access-token sources - #772
Merged
Conversation
The client encoded authorization_details with json.Marshal, and requestobject.Create encoded the whole signed request object the same way, which escapes <, > and & in every json.RawMessage parameter too. A detail holding "A&B <Ltd>" reached the server as & and <: the same JSON value, but longer, and spelled differently from the caller's own bytes, which the server now keeps byte for byte. PAR (as a form parameter or in a request object), CIBA and client_credentials now encode with strictjson.MarshalUnescaped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
JWTAccessTokens.IssuerKeys and OpaqueAccessTokens.Store holding a nil pointer passed their == nil checks, so NewJWTAccessTokens, NewOpaqueAccessTokens and NewVerifier accepted them and the first request panicked. A custom resolver's AccessTokenAssurance had the same gap under AssuranceProduction, where a nil store panicked in the capability check inside NewVerifier itself. Each is now refused, naming the field and its type, as Dependencies' own fields already are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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
Two Low findings left over from the security review since v0.65.1.
authorization_details(fix(client)). The client encodedauthorization_detailswithjson.Marshal, andrequestobject.Createencoded the signed request object the same way. That escapes<,>and&inside everyjson.RawMessageparameter. A detail holdingA&B <Ltd>reached the server asA&B <Ltd>: the same JSON value, but longer, and not the caller's own bytes, which the server now keeps byte for byte (v0.67.2). PAR (plain form or request object), CIBA andclient_credentialsnow usestrictjson.MarshalUnescaped.resource(fix(resource)). A nil pointer inJWTAccessTokens.IssuerKeysorOpaqueAccessTokens.Storepassed the== nilchecks, so construction succeeded and the first request panicked. A custom resolver'sAccessTokenAssurancehad the same gap underAssuranceProduction; a nilStorethere panicked insideNewVerifier's capability check. Each is now refused with the field and type named, asDependencies' own fields already are, and as fix: RARSet without HTML escaping; typed-nil trust fields; RAR hook docs #766 did for the server's trust fields.Neither is breaking: the client sends the same JSON values, and the newly refused configurations could only panic.
Tests
TestAuthorizationDetailsSentWithoutHTMLEscapingcovers the PAR form, the PAR request object, the CIBA request object and theclient_credentialsform. All four fail on main.TestAccessTokensRefuseTypedNilFieldscovers both constructors, value and pointer literals throughNewVerifier, and bothAccessTokenAssurancefields under production. On main, three cases fail and the declared-store case panics.go test ./...passes at go1.26.10.🤖 Generated with Claude Code