Skip to content

[System.Net.Http] Fix Android certificate validation tests - #135786

Closed
tannergooding wants to merge 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-android-http-cert-validation
Closed

tannergooding wants to merge 2 commits into
dotnet:mainfrom
tannergooding:tannergooding-android-http-cert-validation

Conversation

@tannergooding

@tannergooding tannergooding commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Android does not support an empty CustomRootTrust store, and trusting an expired self-signed certificate as its own root can bypass expiry validation. This caused the bad-certificate tests to fail on Android.

Use platform trust when no custom root is specified. For expired-certificate cases, use an expired server leaf signed by a separate, valid root; keep the existing WinHTTP-specific certificate path unchanged.

This resolves #135782

Note

This PR description was prepared with GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@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: @karelz, @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'arch-android': @vitek-karas, @simonrozsival, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

@rzikm

rzikm commented Oct 15, 2026

Copy link
Copy Markdown
Member

/ba-g Only known test errors

@wfurt

wfurt commented Oct 15, 2026

Copy link
Copy Markdown
Member

Should we disable the run on Android if the right capability is not there? I'm not sure if putting all the conditionals to the test brings value.

@rzikm rzikm left a comment

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.

On a second thought, I think we should make the change for all platforms to use the independent root + (possibly expired) leaf cert on the server, to reduce test setup complexity.

Use distinct root and leaf certificates for validation tests. Keep the .NET Framework self-signed fallback because the legacy loopback server cannot present issuer chains.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@tannergooding
tannergooding requested a review from rzikm October 22, 2026 14:25
@rzikm

rzikm commented Oct 26, 2026

Copy link
Copy Markdown
Member

@tannergooding There are merge conflicts, I think the test failures were fixed by #135975

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.

[Test Failure] Http1ResponseStreamZeroByteReadTest.ZeroByteRead_BlocksUntilDataIsAvailable on Android x64 CoreCLR

3 participants