Skip to content

Make AiaCompletionHasLimits handle Windows variance#131242

Open
bartonjs wants to merge 1 commit into
dotnet:mainfrom
bartonjs:fix_AiaCompletionHasLimits
Open

Make AiaCompletionHasLimits handle Windows variance#131242
bartonjs wants to merge 1 commit into
dotnet:mainfrom
bartonjs:fix_AiaCompletionHasLimits

Conversation

@bartonjs

Copy link
Copy Markdown
Member

Fixes #130947 (theoretically)

I've run this on Windows 11 25H2 26200.8893 both with a registry override to force 3 (by setting the limit to 4) and in the default behavior (which wincrypt.h says is 3, but black box says is 2).

This should definitely eliminate failures from getting 5 on the first answer. But, along the fix development path it appears that Windows is squirrelling away the previous AIA fetches, and so RetryHelper might take a problem and amplify it. (Since I don't see the certs ending up in persisted stores, I'm going to guess they don't count AIA fetches if they're in memory in the Windows version of the AIA fetch cache)

@bartonjs bartonjs self-assigned this Jul 22, 2026
Copilot AI review requested due to automatic review settings July 22, 2026 23:35
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

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 updates the AiaCompletionHasLimits revocation test to tolerate observed Windows differences in how many AIA certificates can be materialized per X509Chain.Build call (2 vs 3), reducing test flakiness across Windows builds.

Changes:

  • Increase the generated intermediate CA chain length used by AiaCompletionHasLimits (from 6 → 8).
  • Add branching logic to accept either 4 or 5 chain elements after the first build, and adjust subsequent expected counts and extra-store cloning accordingly.
  • Update final chain expectations to reflect the longer chain (ending at 10 elements).

Comment on lines +314 to 317
// AIA fetches intermediate7 and root, chain finishes.
AssertExtensions.TrueExpression(chain.Build(endEntity));
Assert.Equal(8, chain.ChainElements.Count);
Assert.Equal(10, chain.ChainElements.Count);
Assert.Equal(X509ChainStatusFlags.UntrustedRoot, chain.AllStatusFlags());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do think this is true - I am not sure the retry helper gets us what we want since the chain creation is outside the retry.

Comment on lines +264 to +265
// Current Windows only allows 2, by black box testing, but 3 does seem to happen
// on some builds. So, variant test for it being over-sized
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.

[ci-scan] Test failure: System.Security.Cryptography.X509Certificates.Tests.RevocationTests.AiaTests.AiaCompletionHasLimits

3 participants