[C2S] Add DPoP (RFC 9449) support for OAuth token binding#2941
Draft
pfefferle wants to merge 1 commit intoadd/c2s-supportfrom
Draft
[C2S] Add DPoP (RFC 9449) support for OAuth token binding#2941pfefferle wants to merge 1 commit intoadd/c2s-supportfrom
pfefferle wants to merge 1 commit intoadd/c2s-supportfrom
Conversation
Implement Demonstrating Proof of Possession to cryptographically bind access tokens to a client's key pair, preventing token theft and replay. DPoP is fully opt-in: clients that include a DPoP proof header during token issuance get DPoP-bound tokens; clients that don't get regular Bearer tokens with no behavior change. - Add self-contained DPoP proof validator (ES256, RS256) with no external JWT library dependency - Bind tokens to JWK thumbprint (RFC 7638) at issuance - Validate DPoP proofs on resource access for bound tokens - Preserve DPoP binding through token refresh - Advertise dpop_signing_alg_values_supported in server metadata - Add DPoP to CORS allowed headers - Add 27 tests covering proof validation, key binding, and edge cases
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.
Fixes #
Proposed changes:
DPoPproof header during token issuance get DPoP-bound tokens; clients that don't get regular Bearer tokens with no behavior change.Key changes:
DPoPclass (includes/oauth/class-dpop.php) — JWT decode, JWK thumbprint (RFC 7638), JWK-to-PEM conversion, DPoP proof validation with jti replay protectionTokenclass — storesdpop_jktbinding, returnstoken_type: DPoP, preserves binding through refresh, includescnf.jktin introspectionServerclass — acceptsAuthorization: DPoPscheme, validates proofs on resource access, advertisesdpop_signing_alg_values_supportedin metadata, addsDPoPto CORS headersOAuth_Controller— validates DPoP proofs at token endpoint for both auth code and refresh grants, verifies key consistency on refreshOther information:
Testing instructions:
npm run env-test -- --group=oauthnpm run env-test -- --filter=DPoPdpop_signing_alg_values_supported:curl <site>/wp-json/activitypub/1.0/oauth/authorization-server-metadata | jq .dpop_signing_alg_values_supportedChangelog entry
Changelog Entry Details
Significance
Type
Message
Add support for DPoP (RFC 9449) to protect OAuth tokens from theft and replay.