Merging internal commits for release/9.0#124236
Merged
wfurt merged 7 commits intodotnet:release/9.0from Feb 10, 2026
Merged
Conversation
CoseMessage's Decode routines say that any failure is a CryptographicException, but some of the validation failures leak out ArgumentException from the validation in CoseHeaderMap.
…-merge-9.0-2026-02-10-1047
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates COSE decoding/signing behavior and tests to handle indefinite-length CBOR containers and to surface clearer failures around the crit (Critical Headers) header.
Changes:
- Updated signing tests to run against both definite- and indefinite-length encodings for critical headers.
- Added decode tests for Sign1 and MultiSign covering missing/empty/invalid critical headers across attached/detached and definite/indefinite encodings.
- Adjusted COSE header map decoding to support indefinite-length maps and to wrap certain header validation failures as
CryptographicException.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Security.Cryptography.Cose/tests/CoseMessageTests.Sign.CustomHeaderMaps.cs | Expands critical-header signing tests to exercise both definite and indefinite CBOR encodings. |
| src/libraries/System.Security.Cryptography.Cose/tests/CoseMessageTests.DecodeSign1.cs | Adds Sign1 decoding tests for critical-header error cases across attached/detached and definite/indefinite inputs. |
| src/libraries/System.Security.Cryptography.Cose/tests/CoseMessageTests.DecodeMultiSign.cs | Adds MultiSign decoding tests for critical-header error cases across attached/detached and definite/indefinite inputs. |
| src/libraries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseMessage.cs | Allows decoding of indefinite-length header maps and improves error reporting for invalid header values; adds empty-crit validation. |
Comments suppressed due to low confidence (1)
src/libraries/System.Security.Cryptography.Cose/tests/CoseMessageTests.DecodeSign1.cs:1
- The switch arm for
(true, true)(detached + indefinite length) returnsDetachedDefiniteHex, which duplicates the(true, false)case and prevents this test from actually exercising the detached/indefinite input. Update that arm to useDetachedIndefiniteHex.
// Licensed to the .NET Foundation under one or more agreements.
...aries/System.Security.Cryptography.Cose/src/System/Security/Cryptography/Cose/CoseMessage.cs
Show resolved
Hide resolved
wfurt
approved these changes
Feb 10, 2026
This was referenced Feb 11, 2026
Open
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.
No description provided.