-
Notifications
You must be signed in to change notification settings - Fork 5k
Allow access to connection info in certificate validation callback #115186
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
Allow access to connection info in certificate validation callback #115186
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.
/azp run runtime-libraries-coreclr outerloop
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 enhances certificate validation by allowing a custom certificate callback in client authentication, and refines the handshake validation logic in SslStream by checking the connection protocol.
- Updated RemoteCertificateValidationCallback in the client test to use a provided callback when available.
- Modified the handshake error-checking condition in SslStream to validate using _connectionInfo.Protocol.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs | Updated test to support a custom certificate callback fallback. |
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.cs | Revised handshake validation logic to check _connectionInfo.Protocol instead of IsAuthenticated. |
Comments suppressed due to low confidence (2)
src/libraries/System.Net.Security/tests/FunctionalTests/ClientAsyncAuthenticateTest.cs:148
- Ensure test coverage includes scenarios where a non-null certificateCallback is provided, verifying that the custom callback is executed as expected.
RemoteCertificateValidationCallback = certificateCallback ?? AllowAnyServerCertificate,
src/libraries/System.Net.Security/src/System/Net/Security/SslStream.cs:931
- Verify that checking _connectionInfo.Protocol for a zero value accurately represents an unauthenticated state across all valid protocol scenarios to prevent any unintended behavior.
if (_connectionInfo.Protocol == 0)
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones |
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
…Callback-has-regressed-to-being-unable-to-access-protocolcipher-info
/ba-g Test failures are unrelated, Build Analysis job stuck |
@rzikm It would seem that this change regressed
Any idea on fixing this ? cc @simonrozsival |
for now, we can perhaps disable that test on Android. I also talk with @simonrozsival few weeks back and it may be good to run android test in networking and security changes. Any thoughts on that @dotnet/ncl ? |
Fixes #114351.