Improve Certificate Policy tests by bartonjs · Pull Request #130269 · dotnet/runtime · GitHub
Skip to content

Improve Certificate Policy tests - #130269

Merged
bartonjs merged 6 commits into
dotnet:mainfrom
bartonjs:improve_certpol_tests
Jul 13, 2026
Merged

bartonjs merged 6 commits into
dotnet:mainfrom
bartonjs:improve_certpol_tests

Conversation

@bartonjs

@bartonjs bartonjs commented Jul 6, 2026

Copy link
Copy Markdown
Member

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".

Copilot AI review requested due to automatic review settings July 6, 2026 23:18
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.MakeTestChain to 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.ReadPolicies for 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.

@bartonjs

bartonjs commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

Tests passed on main platforms, I'll push the whitespace change then trigger it for extra platforms

Copilot AI review requested due to automatic review settings July 7, 2026 23:46
@bartonjs

bartonjs commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings July 8, 2026 20:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

@bartonjs

bartonjs commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI review requested due to automatic review settings July 10, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@bartonjs

bartonjs commented Jul 10, 2026 •

Copy link
Copy Markdown
Member Author

@bartonjs
bartonjs enabled auto-merge (squash) July 10, 2026 16:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants