Repository navigation
Preserve peer certificate chain in TlsSession - #134570
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 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: @dotnet/ncl, @bartonjs, @vcsjones |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
CertificateChainPolicy.ExtraStore is shared across sessions from a reusable context, creating concurrency and cross-session certificate contamination risks.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Preserves peer certificate intermediates during external TLS validation, excludes the leaf certificate, and adds context-reuse regression coverage.
Changes:
- Captures and manages peer intermediates from
ExtraStore. - Preserves configured chain-policy entries.
- Applies captured certificates during validation.
- Adds client/server chain and reuse tests.
| File | Summary |
|---|---|
src/libraries/System.Net.Security/tests/FunctionalTests/TlsSessionTests.cs |
Adds chain-preservation and reuse coverage. |
src/libraries/System.Net.Security/src/System/Net/Security/TlsSession.cs |
Captures and manages peer intermediates. |
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs |
Applies captured certificates during validation. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
rzikm
approved these changes
Sep 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Sep 24, 2026
rzikm
approved these changes
Sep 30, 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.

Summary
X509ChainPolicy.ExtraStorebefore the PAL chain is disposedGetRemoteCertificates()consistently across platform PALsTlsContextTlsContextreuseTesting
dotnet buildinsrc/libraries/System.Net.Securitydotnet build /t:test tests/FunctionalTests/System.Net.Security.Tests.csproj(5,035 tests, 0 failures)dotnet build /t:test tests/UnitTests/System.Net.Security.Unit.Tests.csproj(134 tests, 0 failures)dotnet build /t:test tests/EnterpriseTests/System.Net.Security.Enterprise.Tests.csproj(no applicable tests on macOS)Resolves #134567
Note
This pull request description was generated with GitHub Copilot.