feat(rp): RFC 7800 cnf claim (Proof-of-Possession key semantics) - #3
Open
Kunde21 wants to merge 10 commits into
Open
feat(rp): RFC 7800 cnf claim (Proof-of-Possession key semantics)#3Kunde21 wants to merge 10 commits into
Kunde21 wants to merge 10 commits into
Conversation
- Replace commented-out RFC 7638 test with RSA + EC canonical cross-checks that independently verify JWKThumbprint against the RFC algorithm (the prior "inconsistent thumbprint" was a corrupted test vector, not a bug). - Unify DPoP JWK construction: derive the proof header jwk via jose.JSONWebKey.MarshalJSON so the wire key and cnf.jkt thumbprint share one source of truth. Removes the redundant dpopJWKToMap and signatureAlgorithmFromPrivateKey helpers (and the redundant type assertion / else-if-after-return they carried). - Wrap JWKThumbprint's unsupported-key error in ErrInvalidConfiguration so callers can classify it via errors.Is. - Add end-to-end coverage for CallbackResult.Cnf (id_token cnf claim round-trips through HandleCallback).
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
Implements RFC 7800 (Proof-of-Possession Key Semantics for JWTs) via the
cnf(confirmation) claim, closing the last gap in Lanyard's sender-constraint story (DPoP + mTLS already produce proofs, but nothing exposed or verified the resulting token binding).What's included
New API surface (
rp/confirmation.go):Confirmationtype — parses all RFC 7800 cnf members (jkt,x5t#S256,jwk,x5c,x5u,x5t,kid,jwe)JWKThumbprint(priv)— RFC 7638 SHA-256 JWK thumbprint (RSA + EC), viago-joseX509CertThumbprint(cert)— SHA-256 DER thumbprint for mTLSx5t#S256Confirmation.VerifyDPoPBinding/VerifyMTLSBinding— constant-time binding verificationParseAccessTokenConfirmation(rawJWT)— decodecnffrom a JWT access token without signature verification (security caveat in godoc)RP.DPoPKeyThumbprint()— thecnf.jktvalue an AS would mint for this RPIntegration:
idTokenClaims.Cnf+CallbackResult.Cnf— id_tokencnfnow round-trips to callersrp/dpop.gorefactor: DPoP proof header JWK derived viajose.JSONWebKey.MarshalJSON, sharing one source of truth withJWKThumbprint(wire key and binding value can no longer drift)Sentinel errors:
ErrTokenUnbound,ErrTokenBindingMismatch(added torp/errors.go)Scope / non-goals
cnfparsing (Task 8 in the plan) is gated on the unmergedfeat/token-introspectionbranch.Verification
gofumpt,go vet,go buildcleango test ./...— 670 tests pass across 14 packagesJWKThumbprintcross-checked against the RFC 7638 canonical algorithm for both RSA and EC (independently computes the canonical JSON → SHA-256); all commits GPG-signedTest plan
rp/confirmation_test.go— type round-trip, thumbprint algorithms (RSA + EC), X.509 thumbprint, both binding-verify methods, ParseAccessTokenConfirmationrp/dpop_test.go—RP.DPoPKeyThumbprint, header-JWK-matches-thumbprint invariantrp/idtoken_test.go— id_tokencnfparsing (present + nil-safe)rp/callback_test.go— end-to-endCallbackResult.Cnfexposure throughHandleCallbackPlan
See
thoughts/plans/2026-06-21-rfc7800-cnf-claim.md(included in this PR) for the full task-by-task implementation plan.🤖 Generated with Claude Code