Skip to content

Enforce 16-byte minimum credential ID length at registration#39

Merged
JanTvrdik merged 1 commit into
masterfrom
credential-id-min-length
Jul 13, 2026
Merged

Enforce 16-byte minimum credential ID length at registration#39
JanTvrdik merged 1 commit into
masterfrom
credential-id-min-length

Conversation

@JanTvrdik

Copy link
Copy Markdown
Member

The credential ID definition requires authenticators to emit at least 16 bytes (with ≥100 bits of entropy). §7.1 does not mandate this check on the relying party — it only bounds the maximum at 1023 bytes (step 25) — but a shorter ID can only come from a non-conforming or malicious authenticator, so consistent with the library's fail-closed posture, registration now rejects credential IDs shorter than 16 bytes with a new credential_id_too_short reason code.

FakeAuthenticator already emits exactly 16-byte IDs, so no test-double changes were needed.

Co-Authored-By: Claude Code

Copilot AI review requested due to automatic review settings July 13, 2026 20:35

Copilot AI 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.

Pull request overview

Adds a fail-closed registration-time validation to reject non-conforming WebAuthn credential IDs shorter than 16 bytes (per the credential ID definition), introducing a new credential_id_too_short reason code and a regression test to lock in the behavior.

Changes:

  • Add RelyingParty::MIN_CREDENTIAL_ID_LENGTH = 16 and enforce it during registration verification.
  • Introduce VerificationException::CREDENTIAL_ID_TOO_SHORT reason code for consistent failure signaling.
  • Add a unit test ensuring undersized credential IDs are rejected.

Reviewed changes

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

File Description
tests/Ceremony/RelyingPartyTest.php Adds a negative test asserting registration rejects 15-byte credential IDs.
src/Ceremony/VerificationException.php Adds a new stable reason code: credential_id_too_short.
src/Ceremony/RelyingParty.php Introduces a 16-byte minimum credential ID length constant and enforces it during registration verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JanTvrdik
JanTvrdik merged commit cd47759 into master Jul 13, 2026
5 checks passed
@JanTvrdik
JanTvrdik deleted the credential-id-min-length branch July 13, 2026 20:40
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