Skip to content

Conversation

@vcsjones
Copy link
Member

@vcsjones vcsjones commented Nov 5, 2025

The wrong mapping variable was decremented, which could lead to incorrect AnyPolicy depth matching. This would fail-closed, causing a policy mismatch when it shouldn't.

It should be inhibitPolicyMappingDepth, not inhibitAnyPolicyDepth. The latter is handled on line 190.

The wrong mapping variable was decremented, which could lead to incorrect AnyPolicy depth matching.
Copilot AI review requested due to automatic review settings November 5, 2025 21:12
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

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 fixes a bug in certificate policy validation where the wrong depth counter was being decremented, and adds supporting test infrastructure and a test case to verify the fix.

  • Fixes a bug where inhibitAnyPolicyDepth was incorrectly decremented instead of inhibitPolicyMappingDepth in the certificate policy validation logic
  • Adds a new overload of MakeTestChain4 that allows specifying different extensions for each intermediate certificate independently
  • Adds a test case to verify policy constraints work correctly with multiple intermediate certificates

Reviewed Changes

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

File Description
CertificatePolicy.cs Fixes the bug by changing the decremented variable from inhibitAnyPolicyDepth to inhibitPolicyMappingDepth
TestDataGenerator.cs Adds new overload of MakeTestChain4 to support separate extension parameters for two intermediate certificates
DynamicChainTests.cs Adds test case PolicyConstraints_AnyPolicyInhibited_Success and helper method BuildInhibitAnyPolicy

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants