Skip to content

Use private PKI for untrusted TLS session certificate test - #133875

Merged
rzikm merged 1 commit into
dotnet:mainfrom
rzikm:fix-tls-session-untrusted-certificate
Sep 15, 2026
Merged

rzikm merged 1 commit into
dotnet:mainfrom
rzikm:fix-tls-session-untrusted-certificate

Conversation

@rzikm

@rzikm rzikm commented Sep 14, 2026

Copy link
Copy Markdown
Member

System.Net.Security.Tests.TlsSessionTests.ClientSession_ExternalCertificateValidation_AcceptWithDefaultValidation_FailsOnUntrustedCert used to fail on my machine because the issuer cert was installed on my trust root. Change the test to generate a fresh certificate chain instead of relying on the shared test CA being untrusted.

Generate a fresh certificate chain instead of relying on the shared test CA being untrusted. Send the generated chain and assert RemoteCertificateChainErrors explicitly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 14, 2026 13:15
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones
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.

🟢 Approval recommended

The change is focused, deterministic, and has no unresolved review issues.

Pull request overview

Updates the TLS session test to use a freshly generated private PKI chain, making untrusted-certificate validation deterministic.

Changes:

  • Generates a fresh localhost certificate chain.
  • Supplies the full chain to the server.
  • Verifies the expected chain validation error.
File summaries
File Description
src/libraries/System.Net.Security/tests/FunctionalTests/TlsSessionTests.cs Makes the untrusted-certificate test independent of machine trust-store state.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

@rzikm
rzikm merged commit e2240ff into dotnet:main Sep 15, 2026
81 of 84 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 16, 2026
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 18, 2026
…3875)

System.Net.Security.Tests.TlsSessionTests.ClientSession_ExternalCertificateValidation_AcceptWithDefaultValidation_FailsOnUntrustedCert
used to fail on my machine because the issuer cert was installed on my
trust root. Change the test to generate a fresh certificate chain
instead of relying on the shared test CA being untrusted.

Co-authored-by: Copilot App <223556219+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.

3 participants