Skip to content

[ABCA] Add replay protection for Client Attestation PoP JWTs - #51623

Draft
Ogenbertrand wants to merge 18 commits into
keycloak:mainfrom
adorsys:issue-44770
Draft

[ABCA] Add replay protection for Client Attestation PoP JWTs#51623
Ogenbertrand wants to merge 18 commits into
keycloak:mainfrom
adorsys:issue-44770

Conversation

@Ogenbertrand

Copy link
Copy Markdown
Contributor

Implements replay attack protection for Attestation-Based Client Authentication by tracking used PoP JWT jti values per attested client instance within an iat-based sliding window. Also adds regression coverage for PoP JWT reuse, stale PoP JWTs, and preserves challenge reuse detection behavior.

Closes: #44770

Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
Signed-off-by: Ogenbertrand <ogenbertrand@gmail.com>
@Ogenbertrand
Ogenbertrand requested a review from a team as a code owner August 11, 2026 12:46
Copilot AI balanced review requested due to automatic review settings August 11, 2026 12:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds ABCA PoP JWT replay protection and challenge support.

Changes:

  • Tracks used PoP JWT identifiers within an issuance-time window.
  • Adds and advertises the attestation challenge endpoint.
  • Adds regression tests and OAuth test utilities.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/utils-shared/.../Endpoints.java Adds challenge endpoint URL.
tests/utils-shared/.../ClientAttestationChallengeResponse.java Parses challenge responses.
tests/utils-shared/.../ClientAttestationChallengeRequest.java Sends challenge requests.
tests/utils-shared/.../AbstractOAuthClient.java Exposes the request helper.
tests/base/.../OID4VCBasicWallet.java Supports custom challenge, JTI, and issuance time.
tests/base/.../OIDCAttestationBasedClientAuthenticationTest.java Tests challenges and replay rejection.
services/.../OIDCWellKnownProvider.java Advertises the challenge endpoint.
services/.../OIDCLoginProtocolService.java Registers the endpoint route.
services/.../ClientAttestationChallengeEndpoint.java Issues signed challenges.
services/.../ClientAttestationChallengeResponse.java Defines the response payload.
services/.../AttestationBasedClientAuthenticator.java Implements replay and challenge validation.
core/.../OIDCConfigurationRepresentation.java Adds challenge metadata.
core/.../OAuthErrorException.java Adds the challenge-required error code.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +83 to +84
ProfileHelper.requireFeature(Profile.Feature.CLIENT_AUTH_ABCA);
checkSsl();
throw new TokenSignatureInvalidException(attestationPoPJwt, "Invalid token signature");
}

ensureClientAttestationPoPNotReplayed(session, attestationJwt, attestationPoPJwt, clientKey);
@Ogenbertrand

Copy link
Copy Markdown
Contributor Author

This PR should be reviewed once: #51574 is merged, as replay protection includes challenge reuse detection integration. So i'll convert it to draft for now.

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.

[ABCA] Implement Replay Attack Protection

2 participants