Repository navigation
Fix TlsSession's ClientHello peek failure message - #135700
Merged
Merged
Conversation
When CryptoNative_BioPeekTlsFrame fails (the peer closes or resets the
connection before a full record arrives, recv fails, or the record
header announces more than the peek buffer holds), TlsSession threw
IOException(SR.net_ssl_read_bio_failed_error) without formatting it,
so the message read "SSL Read BIO failed with OpenSSL error - {0}.".
None of those failures pushes an OpenSSL error, so there is nothing
true to put in the placeholder either.
Throw the IOException with a new placeholder-free resource,
net_ssl_read_client_hello_failed: "The TLS ClientHello could not be
read from the socket."
Fix dotnet#135694
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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. |
Contributor
|
Tagging subscribers to this area: @dotnet/ncl, @bartonjs, @vcsjones |
This was referenced Oct 13, 2026
Closed
Member
|
/ba-g test failures are unrelated |
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.
When a server
TlsSocketSessionon Linux fails to read the ClientHello off the socket (the client closes or resets the connection before a full TLS record arrives, or the record header announces more bytes than the read buffer holds),TlsSessionthrewIOException(SR.net_ssl_read_bio_failed_error)withoutSR.Format, so the message wasSSL Read BIO failed with OpenSSL error - {0}.Formatting it would not help:
CryptoNative_BioPeekTlsFrameclears the OpenSSL error queue on entry and none of its-1returns pushes an OpenSSL error, so there is no OpenSSL error to name.This change throws the same
IOExceptionwith a new resource without a placeholder,net_ssl_read_client_hello_failed("The TLS ClientHello could not be read from the socket."). The other uses ofnet_ssl_read_bio_failed_error, which go throughInterop.OpenSsl.CreateSslException, are unchanged.SocketBoundServerSession_ClientHelloPeekFails_ThrowsIOExceptionWithMessageis a new Linux test with a row for each failure: the client shuts down its sending side, the client resets the connection, and the client sends a handshake record header announcing a 65535-byte fragment. Each row drivesHandshake()on the server session, expects anIOException, and asserts that its message contains neither{0}norOpenSSL. Every row fails on the old code withAssert.DoesNotContain() Failure: Sub-string foundand passes with the fix.The System.Net.Security functional tests passed on Linux x64 with the change (OuterLoop tests not run), apart from
NegotiateAuthenticationKerberosTest, whose failures there are the same without the change.Resolves #135694
Note
AI-generated, written at my direction and reviewed by me before posting.
Source read at dotnet/runtime 90b22d9. Tests ran on Ubuntu 22.04.5 LTS x64 (WSL2) with OpenSSL 3.0.2, against a
./build.sh clr+libs -rc Releasebuild of that commit withSystem.Net.Securityrebuilt with this change (./.dotnet/dotnet build src/libraries/System.Net.Security/src), with./.dotnet/dotnet build src/libraries/System.Net.Security/tests/FunctionalTests /t:Test. The old-code runs (the new test, andNegotiateAuthenticationKerberosTest) used the same tree withsrc/libraries/System.Net.Security/srcchecked out at that commit and rebuilt.