Enforce 16-byte minimum credential ID length at registration#39
Merged
Conversation
Co-Authored-By: Claude Code
There was a problem hiding this comment.
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 = 16and enforce it during registration verification. - Introduce
VerificationException::CREDENTIAL_ID_TOO_SHORTreason 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_shortreason code.FakeAuthenticatoralready emits exactly 16-byte IDs, so no test-double changes were needed.Co-Authored-By: Claude Code