Enforce SSL policy errors in custom certificate validation callback#4
Closed
Copilot wants to merge 2 commits into
Closed
Enforce SSL policy errors in custom certificate validation callback#4Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Co-authored-by: henrikhimself <1175002+henrikhimself@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [WIP] Address feedback from review on Aspire Remote Containers beta 1
Enforce SSL policy errors in custom certificate validation callback
Mar 14, 2026
henrikhimself
approved these changes
Mar 14, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Tightens TLS security for Docker connections by ensuring the ServerCertificateCustomValidationCallback respects sslPolicyErrors, preventing acceptance of connections with hostname mismatches or missing certificates even if the chain build succeeds.
Changes:
- Add
SslPolicyErrorsevaluation inServerCertificateCustomValidationCallback. - Reject certificates when any SSL policy error other than
RemoteCertificateChainErrorsis present. - Keep custom trust store /
CustomRootTrustchain validation behavior for the expected chain error scenario.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
The
ServerCertificateCustomValidationCallbackinDockerMessageHandlerdiscarded thesslPolicyErrorsargument entirely, silently accepting connections with hostname mismatches or unavailable certificates as long as the chain built.Changes
DockerMessageHandler.cs: CapturesslPolicyErrorsand reject the connection if any flag other thanRemoteCertificateChainErrorsis set.RemoteCertificateChainErrorsis the only expected error when using a custom trust store and is already handled bychain.Build().This ensures
RemoteCertificateNameMismatchandRemoteCertificateNotAvailableare rejected outright rather than bypassed by a successful chain build.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.