{{ message }}
Repository navigation
Improve Certificate Policy tests - #130269
Merged
Merged
Conversation
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands X.509 certificate policy test coverage by generating more nuanced certificate chains (including a 4-cert chain with per-intermediate extensions) and validating chain-policy behavior across platforms. It also fixes a policy constraint depth accounting bug in the CertificatePolicy implementation.
Changes:
- Extend
TestDataGenerator.MakeTestChainto support per-intermediate extension sets for longer chains. - Add table-driven certificate policy mapping/constraint test cases and a 4-cert chain test helper in
DynamicChainTests. - Fix incorrect depth decrement logic in
CertificatePolicy.ReadPoliciesfor policy mapping inhibition.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/libraries/System.Security.Cryptography/tests/X509Certificates/TestDataGenerator.cs | Adds a new MakeTestChain overload for per-intermediate extensions and refactors chain generation. |
| src/libraries/System.Security.Cryptography/tests/X509Certificates/DynamicChainTests.cs | Adds new certificate policy test cases and a TestChain4 helper (and extends TestChain3). |
| src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/CertificatePolicy.cs | Fixes policy-mapping inhibition depth tracking during policy processing. |
vcsjones
reviewed
Jul 6, 2026
Member
Author
|
Tests passed on main platforms, I'll push the whitespace change then trigger it for extra platforms |
Member
Author
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Jul 8, 2026
Open
Member
Author
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
vcsjones
approved these changes
Jul 8, 2026
This was referenced Jul 9, 2026
Closed
Member
Author
bartonjs
enabled auto-merge (squash)
July 10, 2026 16:35
vcsjones
approved these changes
Jul 10, 2026
This was referenced Jul 11, 2026
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.

This change adds several new certificate policy tests to better cover edge cases.
Since this is one of the areas that is just a thin projection above the Windows OS APIs on .NET Framework, the de facto answers are "our Windows behavior is right".