Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens Botan’s TLS session resumption logic against cross-role session confusion when a single Session_Manager instance is shared between a TLS client and TLS server in the same application.
Changes:
- Enforce connection-side (“role”) checks when resuming sessions on the server side (TLS 1.2
check_for_resume()and TLS 1.3 PSK selection paths). - Filter client-side session discovery so that client handshakes won’t be offered server-established sessions.
- Add/adjust tests to ensure sessions cannot cross the client/server boundary (including PSK resumption cases) and adapt RFC 8448 server tests accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/tests/test_tls_session_manager.cpp | Adds multi-Session_Manager regression tests ensuring role separation and updates existing session-manager tests to match new semantics. |
| src/tests/test_tls_rfc8448.cpp | Adjusts RFC 8448 server-side resumption tests to use a server-role Session variant. |
| src/lib/tls/tls13/tls_extensions_psk.cpp | Adds a role check so the server won’t resume using client-role sessions via the PSK resumption path. |
| src/lib/tls/tls12/tls_server_impl_12.cpp | Adds a server-role guard when checking for TLS 1.2 resumption. |
| src/lib/tls/tls_session_manager.h | Documents the new role-based behavior of retrieve() and find(). |
| src/lib/tls/tls_session_manager.cpp | Implements role filtering in retrieve() and find_and_filter() to prevent cross-role session use. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
reneme
left a comment
There was a problem hiding this comment.
In fact, I would expand on the proposed changes (perhaps in a follow-up), like so:
- Extend the documentation of the virtual storage interface methods: It already states that
retrieve_oneis only called on the server side and likewisefind_someonly on the client side. Those docstrings should also mention that the methods must filter their outputs accordingly (making the filters introduced in this PR a belt-and-suspenders idiom ensuring that custom session managers don't get funky). - Adapt our
TLS::Session_Managerimplementations: we provide a bunch of them, and they should filter their outputs accordingly.
As a result, applications that hold both client and server state in the same place should have a much higher chance of actually benefitting from resumption as expected.
An application which acted as both a TLS server and a TLS client, and which shared a session manager between those two roles, could end up accepting a resumed session that resumed in the wrong role.
7a6839b to
ae38c19
Compare
|
Review comments addressed and I extended the SQL and memory session managers to filter their results |
An application which acted as both a TLS server and a TLS client, and which shared a session manager between those two roles, could end up accepting a resumed session that resumed in the wrong role.