tls: omit SNI for IP literal hosts#11827
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR changes TLS handling to avoid sending SNI when connecting to IP-literal hostnames, updates platform headers, adapts hostname verification for IP literals, and adds an IPv6 integration test that asserts SNI is omitted for an IPv6 literal target. ChangesTLS SNI IPv6 Literal Handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tls/openssl.c`:
- Around line 1651-1655: The hostname verification currently always calls
X509_VERIFY_PARAM_set1_host() in setup_hostname_validation(), which fails for IP
literals; modify setup_hostname_validation() to check host_is_ip_literal(vhost)
(the same check used in setup_sni) and, if true, call
X509_VERIFY_PARAM_set1_ip_asc(param, vhost) instead of
X509_VERIFY_PARAM_set1_host(param, vhost), otherwise keep using
X509_VERIFY_PARAM_set1_host(); reference setup_sni, setup_hostname_validation,
host_is_ip_literal, X509_VERIFY_PARAM_set1_host, and
X509_VERIFY_PARAM_set1_ip_asc when making the change.
In `@tests/integration/scenarios/tls/tests/test_tls_sni_001.py`:
- Around line 45-46: Rename the shadowing parameter in the log_message method:
change the argument name from format to a non-shadowing name like fmt in the
log_message(self, fmt, *args) definition and update any internal references
inside log_message (if any) to use fmt; this removes the built-in shadowing
flagged by Ruff A002 while keeping the method signature and behavior intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7230e8c2-7b4e-411e-8f99-862f80145634
📒 Files selected for processing (3)
src/tls/openssl.ctests/integration/scenarios/tls/config/out_http_tls_ipv6_literal.yamltests/integration/scenarios/tls/tests/test_tls_sni_001.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/tls/openssl.c`:
- Around line 86-138: host_is_ip_literal() currently normalizes bracketed IPv6
and zone-scoped addresses into a local buffer but only returns a boolean, and
the caller still passes the original hostname to X509_VERIFY_PARAM_set1_ip_asc()
which requires a bare numeric IP; change the code so the caller passes a
normalized literal: either extend host_is_ip_literal() to return the normalized
string (e.g., via an out parameter or returned pointer) alongside the boolean,
or, at the site where X509_VERIFY_PARAM_set1_ip_asc() is called, strip
surrounding '[' ']' and drop any "%zone" suffix before calling
X509_VERIFY_PARAM_set1_ip_asc(); ensure you use the same normalization logic
currently in host_is_ip_literal() (bracket removal and truncation at '%') and
only call X509_VERIFY_PARAM_set1_ip_asc() when the normalized string is a valid
inet_pton parse.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4952745f-7180-4c72-bfa2-a1fb310ecf65
📒 Files selected for processing (3)
src/tls/openssl.ctests/integration/scenarios/tls/config/out_http_tls_ipv6_literal.yamltests/integration/scenarios/tls/tests/test_tls_sni_001.py
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/integration/scenarios/tls/config/out_http_tls_ipv6_literal.yaml
- tests/integration/scenarios/tls/tests/test_tls_sni_001.py
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Omit SNI when the target is an IP literal, while still sending SNI for real hostnames and explicit valid tls.vhost hostnames.
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit
Bug Fixes
Tests