Repository navigation
Conversation
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). 3 pipeline(s) were filtered out due to trigger conditions. |
Member
Author
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). 3 pipeline(s) were filtered out due to trigger conditions. |
javiercn
marked this pull request as ready for review
September 24, 2026 16:46
javiercn
requested review from
Youssef1313,
cincuranet,
davpetr and
rokonec
as code owners
September 24, 2026 16:46
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Adds semantic duplicate-key rejection for WebAuthn attestation objects while preserving valid non-preferred CBOR encodings.
Changes:
- Tracks decoded top-level keys using ordinal comparison.
- Adds a dedicated duplicate-key exception.
- Adds coverage for duplicate and non-preferred encodings.
| File | Description |
|---|---|
src/Identity/test/Identity.Test/Passkeys/PasskeyHandlerAttestationTest.cs |
Tests duplicate rejection and compatible encodings. |
src/Identity/Core/src/Passkeys/AttestationObject.cs |
Rejects duplicate decoded keys. |
src/Identity/Core/src/PasskeyExceptionExtensions.cs |
Defines the duplicate-key error. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
This branch has not been deployed
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.
Fixes #69343
Overview
Reject top-level WebAuthn attestation-object map keys that decode to the same text string even when their CBOR bytes differ. The central compatibility constraint is that valid non-preferred CBOR remains accepted rather than imposing canonical serialization.
CborReaderin strict mode compares map keys by encoded bytes, so preferred, non-preferred definite-length, and chunked indefinite-length representations ofauthDatacan coexist even though they decode to the same protocol key. The parser previously allowed the later decoded value to replace the earlier one while the configured verifier received the original encoded object.Design
There are no public API, signature, default, convention, or configuration changes.
AttestationObject.ParseCorenow compares decoded top-level keys withStringComparer.Ordinal. This is intentionally narrower than requiring canonical CBOR and adds the application-level equivalence required by the WebAuthn data model. Detection stays at the top-level parser; nestedattStmtmaps remain opaque and owned by their format-specific verifiers.flowchart LR A[CBOR attestation object] --> B[CborReader strict encoded-key checks] B --> C[Decode top-level text key] C --> D{Ordinal decoded key seen?} D -- Yes --> E[Reject before reading duplicate value] D -- No --> F[Read or skip value] F --> G[Parse authenticator data] G --> H[Invoke attestation verifier]Implementation
The duplicate is rejected immediately after reading its key and before consuming its value, so it cannot replace the selected value and
VerifyAttestationStatementis not invoked. Raw byte-identical duplicates remain rejected by strictCborReaderthrough the existing invalid-format path; byte-distinct semantic duplicates receive the specific duplicate-key failure.Outcome
Red/green verification removed decoded-key tracking and observed semantic-duplicate registration succeed and reach verification, then restored the implementation and observed all targeted cases pass.
Validation
PasskeyHandlerAttestationTest: 118 passed.Microsoft.AspNetCore.Identity.Test: 573 passed, 1 pre-existing skip.