Skip to content

[OID4VCI]: Enforce key_attestations_required when proof JWT omits key_attestation#50732

Merged
mposolda merged 1 commit into
keycloak:mainfrom
adorsys:issue-50517
Jul 27, 2026
Merged

[OID4VCI]: Enforce key_attestations_required when proof JWT omits key_attestation#50732
mposolda merged 1 commit into
keycloak:mainfrom
adorsys:issue-50517

Conversation

@Awambeng

@Awambeng Awambeng commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This PR enforces required key attestations for proof JWT validation

Key Changes

  • Enforce key_attestations_required when the key_attestation header is missing from a proof JWT
  • Reject proof JWTs that omit key_attestation when attestation is required by the credential configuration
  • Reuse AttestationValidatorUtil.getAttestationRequirements() in JwtProofValidator
  • Add createVCIssuanceContextWithoutAttestation() test helper for non-attestation test scenarios
  • Update existing JWT proof validation tests to use the new helper
  • Add an integration test to prevent regression when required key attestations are omitted

Closes #50517

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

This PR closes a validation gap in OID4VCI JWT proof handling by enforcing key_attestations_required even when the proof JWT omits the key_attestation JOSE header, preventing issuance with an unattested key when attestation is required by the credential configuration.

Changes:

  • Enforce presence of key_attestation header claim when key_attestations_required is configured for the JWT proof type.
  • Expose and reuse AttestationValidatorUtil.getAttestationRequirements() from JwtProofValidator.
  • Update/extend test coverage with a dedicated regression test and a helper to build non-attestation contexts for unrelated JWT-proof validation tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/base/src/test/java/org/keycloak/tests/oid4vc/OID4VCIssuerTestBase.java Adjust test realm credential-scope setup to not require key attestation by default (uses null instead of non-null lists).
tests/base/src/test/java/org/keycloak/tests/oid4vc/issuance/signing/OID4VCKeyAttestationTest.java Adds regression test for missing key_attestation when required; adds helper context without attestation requirements and updates existing tests to use it.
services/src/main/java/org/keycloak/protocol/oid4vc/issuance/keybinding/JwtProofValidator.java Rejects JWT proofs that omit key_attestation when the credential configuration requires key attestations.
services/src/main/java/org/keycloak/protocol/oid4vc/issuance/keybinding/AttestationValidatorUtil.java Makes getAttestationRequirements() public so it can be reused by JwtProofValidator.

Copilot AI review requested due to automatic review settings July 21, 2026 08:07

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

…ttestation

- Reject proof JWTs that omit the key_attestation header when the credential
  configuration requires key attestations
- Expose AttestationValidatorUtil.getAttestationRequirements() for reuse in
  JwtProofValidator
- Add createVCIssuanceContextWithoutAttestation() test helper and update
  eight non-attestation JWT proof tests to avoid masking their validation
  intent
- Add integration test to verify proof JWTs without key_attestation are
  rejected when required

Closes keycloak#50517

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Copilot AI review requested due to automatic review settings July 22, 2026 10:17

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@mposolda mposolda 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.

@Awambeng Thanks for the PR! FYI. Created #51179 as a follow-up as it seems we don't have a way to configure key attestations required in the admin UI and maybe we don't test it with integration test.

@mposolda
mposolda merged commit da79957 into keycloak:main Jul 27, 2026
91 checks passed
@Awambeng
Awambeng deleted the issue-50517 branch July 27, 2026 08:23
@Awambeng

Copy link
Copy Markdown
Contributor Author

@Awambeng Thanks for the PR! FYI. Created #51179 as a follow-up as it seems we don't have a way to configure key attestations required in the admin UI and maybe we don't test it with integration test.

Agreed. It's only configurable via the Admin API for now. There are no UI fields or integration tests yet. Thanks for opening #51179 to track that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OID4VCI: key_attestations_required not enforced when key_attestation header absent from proof JWT

3 participants