8000 [OID4VCI]: bind all attested keys and read kid as index in JWT proofs by Awambeng · Pull Request #54638 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

[OID4VCI]: bind all attested keys and read kid as index in JWT proofs - #54638

Draft
Awambeng wants to merge 4 commits into
keycloak:mainfrom
adorsys:issue-54634
Draft

Awambeng wants to merge 4 commits into
keycloak:mainfrom
adorsys:issue-54634

Conversation

@Awambeng
@Awambeng Awambeng commented Nov 4, 2026
Copy link
Copy Markdown
Contributor

This PR addresses the two follow-ups from #53476 on JWT proofs carrying a key attestation.

  • The JWT proof validator now returns all attested_keys when an attestation is present, so the issuer issues one credential per attested key as OpenID4VCI 1.0 Appendix F.1 recommends.
  • When an attested_keys entry has no kid, the proof kid is resolved as the position in attested_keys, matching the Appendix F.1 example (kid "0"). An exact kid match still takes precedence, and unknown kids are rejected as INVALID_PROOF.
  • Batch credential issuance now caps the number of issued credentials instead of the number of proofs, since a single proof can bind several keys, and only nonces of issued credentials are collected.
  • Tests: unit coverage for kid resolution (key id, positional match, key id precedence, out of range, non-numeric) and end-to-end coverage for positional kid proofs, including a proof signed by attested_keys[1], plus multi-key SD-JWT issuance with both jwt and attestation proof types.

Closes #54634

@eudi-dev-bot eudi-dev-bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review by Claude Code: Fix first · 1 should fix

The PR makes JwtProofValidator return every key in attested_keys and makes the endpoint issue one credential per returned key, which also takes effect for the unchanged attestation proof type. It resolves a numeric proof kid as a position in attested_keys and caps the batch by credentials instead of proofs. The fan out is clean, and each credential is built separately, so salts and generated ids stay unique. One case is new and wrong: several JWT proofs that carry the same key attestation each add the full attested key list, so the wallet gets duplicate credentials for the same keys.

For EUDI:

EUDI wallets that send one proof with a WUA listing several keys now receive one PID or attestation per key, which batch issuance and unlinkability under the ARF need. Wallets that send one JWT proof per key with the same WUA get linkable duplicates when batch_size is larger than the number of proofs, unless the scope sets vc.key_attestation.proof_key_index to 0, which rejects such requests anyway.

Claude Code wrote this review of 2eaf285. It read the code without building or running it.

Awambeng asked the tracker's bot account to post this.

Automatic review by Claude Opus 5.5, checked by Claude Fable 5.2: https://oid4vc-sig.eudi-test.dev/reviews/54638.html

- Add vc.key_attestation.proof_key_index to allow a credential configuration
to require the proof signing key to be attested_keys[0], as required by
ETSI TS 119 472-3 and Regulation (EU) 2026/1731.

- If the option is not set, the existing membership check is kept for
backwards compatibility.

Closes keycloak#52786

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
- return every attested key from the JWT proof validator and issue one credential per key
- resolve a JWT proof kid against attested_keys by key id first, then by position
- apply the batch limit to issued credentials and collect nonces only for issued ones
- add validator and integration tests for kid positions and multi-key issuance

Closes keycloak#54634

Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
Signed-off-by: Awambeng Rodrick <awambengrodrick@gmail.com>
@eudi-dev-bot eudi-dev-bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI review by Claude Code: Merge as is · 1 follow-up

The PR makes JwtProofValidator return every key in attested_keys and makes the credential endpoint build one credential per returned key, for both the jwt and the attestation proof types. A numeric proof kid without an exact match resolves to the key at that position, and the batch limit now applies to credentials instead of proofs. Keys that an earlier proof in the same request already bound are skipped by JWK thumbprint, so the duplicate credentials from the earlier review no longer occur. The signature check against the resolved key and the trust check on the key attestation still guard every path, and I found nothing that must change.

For EUDI:

EUDI wallets that send one proof with a WUA listing several keys now get one PID or attestation per key up to the realm batch_size, as batch issuance and unlinkability under the ARF need. When the scope sets vc.key_attestation.proof_key_index to 0, the proof must be signed by attested_keys[0], so a wallet has to send that single proof and a request with a further proof signed by another attested key is rejected.

Claude Code wrote this review of 738fbd5. It read the code without building or running it.

Awambeng asked the tracker's bot account to post this.

Automatic review by Claude Opus 5.5, checked by Claude Fable 5.2: https://oid4vc-sig.eudi-test.dev/reviews/54638.html

}

// A proof can bind several attested keys, so the limit applies to credentials, not proofs.
if (vcIssuanceContexts.size() > maxBatchSize) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Follow-up · No test covers the new credential cap when attested keys exceed batch_size.

Impact:

A WUA with more keys than the realm batch_size relies on this cap, and a regression would issue more credentials than the operator allowed without any test failing.

testCompleteSdJwtIssuanceWithMultipleAttestedKeys uses two keys with the default limit of 2, and the deduplication test uses a limit of 10, so the truncation at line 1070 and the nonce collection after it never run with a cut.

Suggested fix:

Add an end to end test with three attested keys and batch_size 2 that asserts two credentials bound to attested_keys[0] and attested_keys[1] and that the nonce is consumed.

Awambeng asked the tracker's bot account to post this.

Automatic review by Claude Opus 5.5, checked by Claude Fable 5.2: https://oid4vc-sig.eudi-test.dev/reviews/54638.html#c-5faacb5b810f41fd-0

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: bind all attested keys and read kid as index in JWT proofs

2 participants

0