Skip to content

Reject credential IDs longer than 1023 bytes on registration - #517

Merged
santiagorodriguez96 merged 4 commits into
masterfrom
sr--verify-credential-id-length
Oct 22, 2026
Merged

santiagorodriguez96 merged 4 commits into
masterfrom
sr--verify-credential-id-length

Conversation

@santiagorodriguez96

Copy link
Copy Markdown
Contributor

Motivation

WebAuthn L3 specification recommends to fail if the credential ID is larger that 1023 bytes:

  1. Verify that the credentialId is ≤ 1023 bytes. Credential IDs larger than this many bytes SHOULD cause the RP to fail this registration ceremony.

We are not checking this – AttestedCredentialData reads bit16 :id_length, so anything up to 65535 bytes is accepted.

Details

This PR makes registration reject any credential whose ID is longer than 1023 bytes, which is the limit the WebAuthn spec sets. Verification now raises the new WebAuthn::CredentialIdLengthVerificationError in that case.

WebAuthn Level 3 says that credential IDs longer than 1023 bytes
SHOULD cause the relying party to fail the registration ceremony.
The attested credential data reads the ID length as a 16-bit value,
so IDs of up to 65535 bytes were accepted. Verification now raises
`WebAuthn::CredentialIdLengthVerificationError` for them.

This check runs last, after all other registration checks. Because
it is only a recommendation, a relying party can rescue the error
and still store the credential, as with
`WebAuthn::SignCountVerificationError`.

https://www.w3.org/TR/webauthn-3/#sctn-registering-a-new-credential
@santiagorodriguez96
santiagorodriguez96 merged commit 0027be3 into master Oct 22, 2026
49 checks passed
@santiagorodriguez96
santiagorodriguez96 deleted the sr--verify-credential-id-length branch October 22, 2026 20:24
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.

2 participants