THRIFT-3165: Disable TLSv1.0 and TLSv1.1 by default#3600
Conversation
5948ff4 to
79a85c8
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates Thrift C++ SSL defaults to require TLS 1.2+ by default, while enabling applications to inject a custom SSLContext when different protocol ranges are needed.
Changes:
- Raise the default
SSLTLSprotocol floor by disabling TLS 1.0 and TLS 1.1 inSSLContext. - Add
TSSLSocketFactoryconstructor overload that accepts anSSLContextfactory callback. - Update SSL security matrix expectations, add targeted tests, and document the new default behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/cpp/src/thrift/transport/TSSLSocket.cpp | Enforces TLS 1.2+ for SSLTLS and introduces factory-based SSLContext construction with safer init/cleanup handling. |
| lib/cpp/src/thrift/transport/TSSLSocket.h | Adds SSLContextFactory type + new TSSLSocketFactory ctor; updates protocol documentation. |
| lib/cpp/test/SecurityTest.cpp | Adds tests for default/custom SSL context options; updates expected protocol compatibility matrix. |
| lib/cpp/test/SecurityFromBufferTest.cpp | Updates expected protocol compatibility matrix for buffer-based SSL tests. |
| lib/cpp/README.md | Documents new default minimum TLS version and how to override via custom context factory. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Code reviewFound 2 issues:
thrift/lib/cpp/src/thrift/transport/TSSLSocket.cpp Lines 925 to 929 in 009a524
thrift/lib/cpp/test/SecurityTest.cpp Lines 235 to 242 in 009a524 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
|
Thanks @Jens-G, addressed both in the latest push.
Validation run locally:
|
| std::shared_ptr<apache::thrift::transport::SSLContext> context; | ||
| TSSLSocketFactory factory([&context]() { | ||
| context = std::make_shared<CustomSSLContext>(); | ||
| return context; | ||
| }); | ||
| const auto options = SSL_CTX_get_options(context->get()); |
There was a problem hiding this comment.
Updated in the latest push. custom_ssl_context_options now explicitly resets the captured SSLContext before the test exits, so the extra shared reference is released before TSSLSocketFactory reaches its destructor/cleanup path.
| catch (const TSSLException& ex) | ||
| { | ||
| BOOST_CHECK_EQUAL("SSLContextFactory must not be empty", ex.what()); | ||
| } | ||
|
|
||
| try | ||
| { | ||
| TSSLSocketFactory factory([]() { | ||
| return std::shared_ptr<apache::thrift::transport::SSLContext>(); | ||
| }); | ||
| BOOST_FAIL("Expected null SSLContextFactory result to throw"); | ||
| } | ||
| catch (const TSSLException& ex) | ||
| { | ||
| BOOST_CHECK_EQUAL("SSLContextFactory must not return null", ex.what()); | ||
| } |
There was a problem hiding this comment.
Updated in the latest push. The TSSLException message checks now compare against std::string(ex.what()), making the assertions explicit content comparisons.
Client: cpp Co-Authored-By: Codex <noreply@openai.com>
What changed
TSSLSocketFactorydefaultSSLTLScontext to keep version-flexible negotiation while using TLS 1.2 as the default protocol floor.SSLContextfactory constructor so applications can adjust OpenSSL context options before socket creation when they need a different protocol range.Validation
PATH="/opt/homebrew/opt/bison/bin:$PATH" BOOST_ROOT=/opt/homebrew/opt/boost ./configure --with-boost=/opt/homebrew/opt/boost --with-boost-libdir=/opt/homebrew/opt/boost/lib --with-openssl=/opt/homebrew/opt/openssl@3PATH="/opt/homebrew/opt/bison/bin:$PATH" make -C lib/cpp CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"PATH="/opt/homebrew/opt/bison/bin:$PATH" make -C lib/cpp/test CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" BOOST_SYSTEM_LDADD= SecurityTest SecurityFromBufferTestcd lib/cpp/test && DYLD_LIBRARY_PATH="../.libs:.libs:$DYLD_LIBRARY_PATH" ./SecurityTest -- ../../../test/keyscd lib/cpp/test && DYLD_LIBRARY_PATH="../.libs:.libs:$DYLD_LIBRARY_PATH" ./SecurityFromBufferTest -- ../../../test/keysThe SSL matrix tests print expected shutdown messages for protocol combinations that do not complete negotiation.
AI assistance
Co-Authored-By: Codex noreply@openai.com