Repository navigation
fix(tls): reject non-contiguous --tls-protocols on OpenSSL 4.0 - #444
Merged
Merged
Conversation
PR #432 added gap-mask SSL_OP_NO_TLSv1_x #ifdef blocks so the build works on OpenSSL 4.0 (where those constants are slated for removal). But a user passing a non-contiguous bitmask (e.g. tlsv1,tlsv1.2) on OpenSSL 4.0 would silently get the intermediate version enabled inside the envelope, with no warning. Adds parser-time validation: on OpenSSL >= 4.0 a non-contiguous bitmask is rejected at startup with an actionable error. On OpenSSL <= 3.x the gap-mask logic still enforces the user's selection. Refs: 2.4 review #37 (Review 14 + PR #432 review R4). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
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.
Summary
#ifdef SSL_OP_NO_TLSv1_xgap-mask blocks so the build works on OpenSSL 4.0 (where per-version disable constants are removed), but a user passing a non-contiguous--tls-protocolsbitmask (e.g.tlsv1,tlsv1.2) on OpenSSL 4.0 would silently get the intermediate version (TLSv1.1) enabled with no warning.bitmask_is_contiguous()helper (gated under#if OPENSSL_VERSION_NUMBER >= 0x40000000L) and a parser-time check that rejects non-contiguous selections on OpenSSL 4.0+ with an actionable error message.Test plan
Addresses Review 14 + PR #432 Review R4 concern (Refs: 2.4 review #37).
Generated with Claude Code
Note
Medium Risk
Changes TLS protocol selection behavior at startup on OpenSSL 4.0+ builds; previously invalid combinations could negotiate broader protocol versions than intended.
Overview
On OpenSSL 4.0+, per-version
SSL_OP_NO_TLSv1_xgap masking inssl_ctx_initno longer applies, so a non-contiguous--tls-protocolschoice (e.g.tlsv1,tlsv1.2) could silently allow skipped versions (such as TLS 1.1) within the min/max envelope.This PR adds a
bitmask_is_contiguous()helper (compiled only whenOPENSSL_VERSION_NUMBER >= 0x40000000L) and a parse-time check right after--tls-protocolsis parsed that rejects non-contiguous selections with a clear error. Builds against OpenSSL ≤ 3.x are unchanged—the new code is ifdef’d out.Reviewed by Cursor Bugbot for commit 98b49b5. Bugbot is set up for automated code reviews on this repo. Configure here.