-
Notifications
You must be signed in to change notification settings - Fork 5k
Unify certificate chain building between SslStream and WinHttpHandler #115761
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
Co-authored-by: liveans <45091041+liveans@users.noreply.github.com>
Co-authored-by: liveans <45091041+liveans@users.noreply.github.com>
SslStream
and WinHttpHandler
/azp run runtime-libraries-coreclr outerloop-windows |
Azure Pipelines successfully started running 1 pipeline(s). |
Tagging subscribers to this area: @dotnet/ncl |
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.
@copilot Seems like code has unnecessary trailing/leading whitespaces, which causes build failures.
Also, you should be aware that WinHttpHandler
is shared code between .NET and .NET Framework, and some of the APIs we're currently using Marshal.GetLastPInvokeError
in Common\System\Net\Security\CertificateValidation.Windows.cs
which doesn't exist on .NET Framework, we might need to do some changes here.
src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http.WinHttpHandler/src/System/Net/Http/WinHttpRequestCallback.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: liveans <45091041+liveans@users.noreply.github.com>
Fixed the whitespace issues in be4a4e4. Removed trailing spaces and reformatted the code to maintain consistent style. Regarding the .NET Framework compatibility, I understand that we may need additional changes to handle the Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Please address this issue as well, be aware that current usage should not change for .NET, we should only handle this case for .NET Framework. |
Co-authored-by: liveans <45091041+liveans@users.noreply.github.com>
Added conditional compilation in c6a5f9d to handle the Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeX509Certificates.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
...tem.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/FakeX509Certificates.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: liveans <45091041+liveans@users.noreply.github.com>
/azp run runtime-libraries-coreclr outerloop-windows |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
LGTM if CI is green
/ba-g Cancelled jobs (failed according to build analysis) are linux, although this change is windows only. Unrelated failures. |
Outerloop failures are also unrelated. |
…#115761) * Initial plan for issue * Update WinHttpRequestCallback to use CertificateValidation Co-authored-by: liveans <45091041+liveans@users.noreply.github.com> * Remove unused WinHttpCertificateHelper.cs file Co-authored-by: liveans <45091041+liveans@users.noreply.github.com> * Fix formatting issues in WinHttpRequestCallback.cs Co-authored-by: liveans <45091041+liveans@users.noreply.github.com> * Fix compatibility with .NET Framework by using GetLastWin32Error Co-authored-by: liveans <45091041+liveans@users.noreply.github.com> * Fix FakeX509Certificates.cs to clarify empty namespace Co-authored-by: krwq <660048+krwq@users.noreply.github.com> * Remove unnecessary code per review comments Co-authored-by: liveans <45091041+liveans@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: liveans <45091041+liveans@users.noreply.github.com> Co-authored-by: krwq <660048+krwq@users.noreply.github.com>
This PR unifies the certificate chain building logic between
SslStream
andWinHttpHandler
by replacing the duplicate implementation inWinHttpCertificateHelper.cs
with the shared implementation fromCertificateValidation.Windows.cs
.Changes
WinHttpCertificateHelper.cs
which contained duplicate certificate chain building logicWinHttpRequestCallback.cs
to use the shared implementation inCertificateValidation.BuildChainAndVerifyProperties
CertificateValidation.Windows.cs
This change makes the codebase more consistent, reduces duplication, and simplifies future maintenance of certificate validation logic.
Fixes #113468.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
dc.services.visualstudio.com
/home/REDACTED/work/runtime/runtime/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/runtime/runtime/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/runtime/runtime/artifacts/toolset/10.0.0-beta.25260.104.txt
(dns block)pkgs.dev.azure.com
/home/REDACTED/work/runtime/runtime/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/runtime/runtime/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/runtime/runtime/artifacts/toolset/10.0.0-beta.25260.104.txt
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.