Cache TLS 1.2 client sessions only after the server Finished verifies - #11393
Open
gasbytes wants to merge 1 commit into
Open
Cache TLS 1.2 client sessions only after the server Finished verifies#11393gasbytes wants to merge 1 commit into
gasbytes wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new “drop ticket” path on Finished verification failure clears logical state but can retain dynamically allocated ticket buffers, which can unnecessarily hold memory after a failed handshake.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes TLS 1.2 client session-ticket caching semantics so that a client session/ticket is only cached after the server Finished has been verified, preventing resumable sessions from being left behind after failed handshakes (per RFC 5246 §7.2.2).
Changes:
- Move TLS 1.2 client session caching to
DoFinished()(post server-Finished verification); keep server caching behavior inSendFinished(). - Clear unverified session tickets when Finished verification fails.
- Add regression tests covering: bad Finished dropping tickets, successful Finished caching, and empty-renewal tickets preserving cached entries.
File summaries
| File | Description |
|---|---|
| tests/api/test_tls.h | Registers three new TLS 1.2 session-ticket caching regression tests in the API test suite. |
| tests/api/test_tls.c | Implements regression tests for caching only after verified Finished and for preserving/dropping tickets in edge cases. |
| src/internal.c | Shifts client-side caching to post-Finished verification, drops unverified tickets on Finished failure, and avoids caching on empty ticket renewals. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
…es, so a handshake that fails leaves nothing resumable in the cache RFC 5246 Section 7.2.2
gasbytes
force-pushed
the
session-ticket-cache-fix
branch
from
September 7, 2026 15:22
46defbd to
83c6bed
Compare
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.
Description
The client cached its session and ticket before verifying the server Finished,
so a failed handshake left a resumable session behind (RFC 5246 Section 7.2.2).
Caching moves to DoFinished(); the server path is unchanged.
Testing
Added three regression tests to also cover the edge cases: ticket dropped on a bad Finished, cached after a good one, and preserved across a resumption with an empty NewSessionTicket.
Checklist