Repository navigation
Align CoseKey async verification with synchronous validation - #130973
Merged
Merged
Conversation
|
Azure Pipelines: 15 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Co-authored-by: vcsjones <361677+vcsjones@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
Copilot
AI
changed the title
[WIP] Fix CoseKey overloads of VerifyAsync to match synchronous Verify
Align CoseKey async verification with synchronous validation
Jul 17, 2026
vcsjones
approved these changes
Jul 17, 2026
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes COSE signature verification stricter and consistent by ensuring async verification performs the same protected alg header validation as the sync paths when verifying with a CoseKey.
Changes:
- Add protected
algvalidation toVerifyDetachedAsync(CoseKey, Stream, …)for bothCoseSign1MessageandCoseSignature. - Refactor
CoseSign1Messagesync verification to reuse a sharedValidateAlgorithmhelper. - Add regression tests covering missing and mismatched protected
algheaders and asserting sync/async parity.
Show a summary per file
| File | Description |
|---|---|
| src/libraries/System.Security.Cryptography.Cose/tests/CoseSign1MessageTests.Verify.Stream.cs | Adds regression coverage for missing/mismatched protected alg headers and asserts sync/async both throw. |
| src/libraries/System.Security.Cryptography.Cose/tests/CoseMultiSignMessageTests.Verify.Stream.cs | Adds parallel regression coverage for CoseSignature verification in CoseMultiSignMessage. |
| src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseSignature.cs | Adds ValidateAlgorithm(key) before async verification and inside the sync verification core to enforce protected alg matching. |
| src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseSign1Message.cs | Replaces inline sync validation with ValidateAlgorithm(key) and adds the same validation to the async verification entrypoint. |
Copilot's findings
- Files reviewed: 4/4 changed files
- Comments generated: 2
bartonjs
reviewed
Jul 17, 2026
3 tasks
This was referenced Jul 17, 2026
Open
vcsjones
temporarily deployed
to
copilot-pat-pool
July 17, 2026 20:09 — with
GitHub Actions
Inactive
vcsjones
temporarily deployed
to
copilot-pat-pool
July 17, 2026 20:09 — with
GitHub Actions
Inactive
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
vcsjones
temporarily deployed
to
copilot-pat-pool
July 17, 2026 20:32 — with
GitHub Actions
Inactive
vcsjones
temporarily deployed
to
copilot-pat-pool
July 17, 2026 20:32 — with
GitHub Actions
Inactive
vcsjones
approved these changes
Jul 17, 2026
bartonjs
approved these changes
Jul 17, 2026
This branch was previously 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
CoseKeyasync verification accepted signatures with missing or mismatched protectedalgheaders, unlike synchronous verification.Validation
CoseSign1MessageandCoseSignature.Coverage