Abort TLS transport on session verification failure#3323
Open
He-Pin wants to merge 1 commit into
Open
Conversation
Motivation: A failed post-handshake session verifier was handled as an SSLEngine failure, causing the GraphStage TLS implementation to emit close_notify instead of aborting the transport. Modification: Handle verifier failures as an explicit TLS stage failure and stop handshake processing. Add a regression test shared by the GraphStage and legacy actor implementations for TLS 1.2 and TLS 1.3. Result: Session verification failures now fail the transport with the original exception while engine-originated TLS failures still flush their fatal alerts. Tests: - stream-tests / Test / testOnly org.apache.pekko.stream.io.TlsGraphStageSpec (113 passed) - stream-tests / Test / testOnly org.apache.pekko.stream.io.TlsSpec (113 passed) - +headerCheckAll (passed) - checkCodeStyle (passed) - validatePullRequest (environment failure: leveldbjni-all 1.8 has no macOS ARM64 binary; remaining unrelated tests stopped) References: Fixes apache#3245
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.
Motivation
A failed post-handshake session verifier was handled as if the
SSLEngineitself had failed. When the verifier returned anSSLException, the GraphStage TLS implementation caught it in the engine failure path and calledcloseOutbound(). Because the handshake had already succeeded and there was no pending fatal alert, this generatedclose_notifyand completed the transport gracefully instead of aborting it.Engine-originated handshake failures are intentionally left unchanged: those paths must continue wrapping and flushing pending fatal alerts such as
certificate_unknown.Modification
verifySessionresult as an explicit TLS stage failure.Result
Post-handshake session verification failures now abort the transport with the original exception. The GraphStage behavior matches the legacy TLS actor, while engine-originated TLS failures continue to flush their fatal alerts.
Tests
stream-tests / Test / testOnly org.apache.pekko.stream.io.TlsGraphStageSpec— 113 passedstream-tests / Test / testOnly org.apache.pekko.stream.io.TlsSpec— 113 passed+headerCheckAll— passedcheckCodeStyle— passedvalidatePullRequest— environment failure:leveldbjni-all 1.8has no macOS ARM64 binary; remaining unrelated tests were stoppedReferences
Fixes #3245