-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow NO_SSL_VERIFY in RawHttpMessageHandler. #3883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for skipping SSL certificate validation in RawHttpMessageHandler
when the GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY
environment variable is set.
- Applies the configured
ServerCertificateValidationCallback
to the transport handler inRawHttpMessageHandler
once per handler for HTTPS requests. - Adds a backing field (
m_appliedServerCertificateValidationCallbackToTransportHandler
) to track application of the callback. - Updates
VssUtil
to setRawClientHttpRequestSettings.Default.ServerCertificateValidationCallback
alongside the existing setting.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/Sdk/Common/Common/RawHttpMessageHandler.cs | Apply ServerCertificateValidationCallback on HTTPS transport handlers and track with a flag. |
src/Runner.Sdk/Util/VssUtil.cs | Configure RawClientHttpRequestSettings for NO_SSL_VERIFY environment variable. |
Comments suppressed due to low confidence (2)
src/Sdk/Common/Common/RawHttpMessageHandler.cs:109
- Use the
Uri.UriSchemeHttps
constant and a case-insensitive comparison for clarity and consistency, e.g.,request.RequestUri.Scheme.Equals(Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase)
.
if (!m_appliedServerCertificateValidationCallbackToTransportHandler && request.RequestUri.Scheme == "https")
src/Sdk/Common/Common/RawHttpMessageHandler.cs:109
- Add unit tests under
Test/L0
to verify that whenGITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY
is enabled,RawHttpMessageHandler
correctly applies theDangerousAcceptAnyServerCertificateValidator
callback.
if (!m_appliedServerCertificateValidationCallbackToTransportHandler && request.RequestUri.Scheme == "https")
@@ -38,6 +38,7 @@ public static void InitializeVssClientSettings(List<ProductInfoHeaderValue> addi | |||
if (StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY"))) | |||
{ | |||
VssClientHttpRequestSettings.Default.ServerCertificateValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; | |||
RawClientHttpRequestSettings.Default.ServerCertificateValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Update the public README or configuration documentation to mention the new GITHUB_ACTIONS_RUNNER_TLS_NO_VERIFY
environment variable and its effect on raw HTTP handlers.
Copilot uses AI. Check for mistakes.
No description provided.