Add regression test for expired self-signed trusted chain (#48794) - #131398
Open
virzak wants to merge 1 commit into
Open
Add regression test for expired self-signed trusted chain (#48794)#131398virzak wants to merge 1 commit into
virzak wants to merge 1 commit into
Conversation
|
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. |
Contributor
|
Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security |
virzak
force-pushed
the
test/48794-expired-selfsigned-chain
branch
from
July 26, 2026 18:19
290e3ce to
ce3e1ce
Compare
bartonjs
reviewed
Jul 26, 2026
bartonjs
left a comment
Member
There was a problem hiding this comment.
Two minor things, otherwise looks good. Thanks :)
Comment on lines
+1732
to
+1740
| // Regression test for https://github.com/dotnet/runtime/issues/48794 | ||
| // | ||
| // An expired self-issued (self-signed) certificate that is trusted must build | ||
| // successfully when NotTimeValid is ignored, with the certificate's expiration | ||
| // being the only reported error. Historically on Linux this scenario additionally | ||
| // reported UntrustedRoot (the expired trust anchor was not recognized as trusted) | ||
| // and RevocationStatusUnknown (revocation processing was skipped for the | ||
| // "not time valid" chain), causing Build to return false while it returned true on | ||
| // Windows and macOS. |
Member
There was a problem hiding this comment.
I don't think the comment adds anything.
Suggested change
| // Regression test for https://github.com/dotnet/runtime/issues/48794 | |
| // | |
| // An expired self-issued (self-signed) certificate that is trusted must build | |
| // successfully when NotTimeValid is ignored, with the certificate's expiration | |
| // being the only reported error. Historically on Linux this scenario additionally | |
| // reported UntrustedRoot (the expired trust anchor was not recognized as trusted) | |
| // and RevocationStatusUnknown (revocation processing was skipped for the | |
| // "not time valid" chain), causing Build to return false while it returned true on | |
| // Windows and macOS. |
Comment on lines
+1730
to
+1731
| [InlineData(X509RevocationMode.NoCheck, X509RevocationFlag.ExcludeRoot)] | ||
| [InlineData(X509RevocationMode.Online, X509RevocationFlag.ExcludeRoot)] |
Member
There was a problem hiding this comment.
If the theory isn't varying the revocation flag, let's remove the parameter and simplify the theory
An expired self-issued (self-signed) certificate that is trusted should build successfully when NotTimeValid is ignored, with the certificate's expiration being the only reported error, matching Windows and macOS. The originally reported failure (Build returning false with NotTimeValid,RevocationStatusUnknown,UntrustedRoot on Linux) no longer reproduces on current main across OpenSSL 1.1.1 and 3.0; this test locks in the correct cross-platform behavior for both NoCheck and Online (ExcludeRoot) revocation modes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
virzak
force-pushed
the
test/48794-expired-selfsigned-chain
branch
from
July 26, 2026 19:46
ce3e1ce to
679be73
Compare
Contributor
Author
|
Thanks for the review! Both addressed in the latest push: dropped the comment block and removed the unused |
This was referenced Jul 26, 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 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.
Regression test for #48794.
Background
The issue reported that on Linux, building a chain for an expired, trusted self-issued (self-signed) certificate with
returned
Build() == falsewithNotTimeValid,RevocationStatusUnknown,UntrustedRoot, while Windows returnedtrue. The report was filed against .NET 5 / OpenSSL 1.1.Findings
The scenario no longer reproduces on current
main. Verified end-to-end against a locally built runtime, including the faithful variant that installs the certificate into the userRoottrust store (mirroringupdate-ca-certificates): the chain now builds successfully withNotTimeValidas the only (ignored) status, matching Windows and macOS.Confirmed this holds across both supported OpenSSL lines — a native reproduction of the verify path returns
X509_V_ERR_CERT_HAS_EXPIRED(not an untrusted-root code) for an expired self-signed trust anchor on both OpenSSL 1.1.1 and 3.0. The behavior was closed by intervening chain-handling changes since .NET 5 (notably #66968, "Fix revocation processing on expired chains").Change
Adds
DynamicChainTests.BuildChainForExpiredSelfSignedCertificate, a[Theory]overNoCheckandOnline(ExcludeRoot) revocation, asserting that an expired trusted self-signed certificate builds successfully, does not reportUntrustedRoot/PartialChain, and surfaces only the ignoredNotTimeValid. This locks in the correct cross-platform behavior. Test-only; no product code changes.