Skip to content

fix: report hostname validation from active SSL engine - #999

Open
dkropachev wants to merge 2 commits into
scylladb:scylla-4.xfrom
dkropachev:fix/report-active-hostname-validation
Open

fix: report hostname validation from active SSL engine#999
dkropachev wants to merge 2 commits into
scylladb:scylla-4.xfrom
dkropachev:fix/report-active-hostname-validation

Conversation

@dkropachev

@dkropachev dkropachev commented Aug 12, 2026

Copy link
Copy Markdown

Follow-up to #968.

Removes the newly added hostname-validation accessors and derives the reported value from the active JDK SSLEngine instead. Unknown custom factories remain omitted.

Unrelated changes were extracted into:

Tests:

  • mvn -pl core -DskipITs -Dtest=DefaultDriverConfigReporterTest,ProtocolInitHandlerTest,CloudConfigFactoryTest test
  • full GitHub Actions matrix

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: e79baa61-7858-4eb5-a2e0-d9e0239e8890

📥 Commits

Reviewing files that changed from the base of the PR and between dcfd2d2 and 38b3d57.

📒 Files selected for processing (2)
  • core/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/ProtocolInitHandlerTest.java
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • scylladb/github-automation (auto-detected)
  • scylladb/scylladb (auto-detected)

Included review availability: Your plan includes up to 3 reviews per rolling hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The change removes hostname-validation accessors from SSL engine factories. JdkSslHandlerFactory records validation state from each created SSLEngine. DefaultDriverConfigReporter reads this state from the active channel and omits unknown values. The reporter API now accepts a channel. Tests cover overridden engines, SNI endpoints, unknown factories, removed handlers, and control-channel state.

Sequence Diagram(s)

sequenceDiagram
  participant ProtocolInitHandler
  participant DriverConfigReporter
  participant JdkSslHandlerFactory
  participant SSLEngine
  ProtocolInitHandler->>DriverConfigReporter: pass control channel
  DriverConfigReporter->>JdkSslHandlerFactory: read channel validation state
  JdkSslHandlerFactory->>SSLEngine: inspect SSL parameters
  DriverConfigReporter-->>ProtocolInitHandler: build configuration report
Loading

Suggested reviewers: nikagra

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.59% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: reporting hostname validation from the active SSL engine.
Description check ✅ Passed The description accurately explains the accessor removal, active SSLEngine inspection, unknown-factory behavior, and test coverage.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
core/src/main/java/com/datastax/oss/driver/internal/core/ssl/JdkSslHandlerFactory.java-47-53 (1)

47-53: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Treat subclasses as custom factories when the algorithm is absent.

instanceof ProgrammaticSslEngineFactory includes user subclasses. A subclass can implement hostname validation without setting an endpoint-identification algorithm. This branch then reports false instead of omitting an unknown value. Use exact-class checks for the built-in fallback.

🤖 Prompt for 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.

In
`@core/src/main/java/com/datastax/oss/driver/internal/core/ssl/JdkSslHandlerFactory.java`
around lines 47 - 53, Update the hostnameValidationRequired fallback in
JdkSslHandlerFactory to use exact-class checks for DefaultSslEngineFactory,
ProgrammaticSslEngineFactory, and SniSslEngineFactory rather than instanceof
checks. Ensure subclasses are treated as arbitrary custom factories, leaving the
value unknown when no endpoint-identification algorithm is configured.
🤖 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
`@core/src/main/java/com/datastax/oss/driver/internal/core/ssl/JdkSslHandlerFactory.java`:
- Around line 33-55: Make hostname-validation state connection-specific instead
of storing it in the shared JdkSslHandlerFactory.hostnameValidationRequired
field. In newSslHandler, attach the computed value to the created SslHandler or
channel, then ensure the DRIVER_CONFIG/reporting path reads that per-connection
state for the same channel rather than the factory field.

---

Other comments:
In
`@core/src/main/java/com/datastax/oss/driver/internal/core/ssl/JdkSslHandlerFactory.java`:
- Around line 47-53: Update the hostnameValidationRequired fallback in
JdkSslHandlerFactory to use exact-class checks for DefaultSslEngineFactory,
ProgrammaticSslEngineFactory, and SniSslEngineFactory rather than instanceof
checks. Ensure subclasses are treated as arbitrary custom factories, leaving the
value unknown when no endpoint-identification algorithm is configured.
🪄 Autofix

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: Organization UI

Review profile: QUIET

Plan: Pro Plus

Run ID: 9b308576-cae4-46e5-88fb-c10cd5bbd93c

📥 Commits

Reviewing files that changed from the base of the PR and between a3d7be6 and c99cd1b.

📒 Files selected for processing (5)
  • core/src/main/java/com/datastax/oss/driver/api/core/ssl/ProgrammaticSslEngineFactory.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporter.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/ssl/DefaultSslEngineFactory.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/ssl/JdkSslHandlerFactory.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/context/DefaultDriverConfigReporterTest.java
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • scylladb/github-automation (auto-detected)
  • scylladb/scylladb (auto-detected)
💤 Files with no reviewable changes (2)
  • core/src/main/java/com/datastax/oss/driver/api/core/ssl/ProgrammaticSslEngineFactory.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/ssl/DefaultSslEngineFactory.java

@dkropachev
dkropachev force-pushed the fix/report-active-hostname-validation branch 2 times, most recently from 6dd1b17 to b9096d0 Compare August 12, 2026 22:06
@coderabbitai coderabbitai Bot added P1 and removed P3 labels Aug 12, 2026
Pass the control channel to the configuration reporter and retain the driver-installed JDK SSL handler on that channel. Read the endpoint-identification algorithm from the exact engine used for the connection instead of exposing diagnostic accessors on SSL engine factories.

Omit hostname verification when the driver-installed handler is unavailable or a disabled state cannot be determined safely.
Treat endpoint-identification parameters as authoritative only when the driver built the trust-manager path that interprets them. Mark configured truststore or keystore contexts and standard cloud bundles as known.

Omit hostname verification for process-wide, programmatic, subclassed, and arbitrary SSL contexts, whose trust managers may enforce or ignore hostname checks independently. Keep only a weak reference to the recorded handler.
@dkropachev
dkropachev force-pushed the fix/report-active-hostname-validation branch from 29fe44b to c53ad68 Compare August 19, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants