Skip to content

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

Open
dkropachev wants to merge 1 commit 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 1 commit into
scylladb:scylla-4.xfrom
dkropachev:fix/report-active-hostname-validation

Conversation

@dkropachev

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.

Tests:

  • mvn -pl core -Dtest=DefaultDriverConfigReporterTest test
  • mvn -pl core test

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

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: 09ab248f-ed6a-446d-8329-9fa51a78bd32

📥 Commits

Reviewing files that changed from the base of the PR and between 6dd1b17 and b9096d0.

📒 Files selected for processing (1)
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelFactoryTestBase.java
🔗 Linked repositories identified

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

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

📝 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, 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

Possibly related PRs

Suggested labels: P1, area/Driver_-_java-driver-4.x

Suggested reviewers: nikagra

Mergeability Score: ⚪ Minimal · up to b9096

The PR derives hostname-validation reporting from the active JDK SSLEngine while preserving omission for unknown custom factories; no actionable merge-blocking risk remains beyond normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.79% 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
Title check ✅ Passed The title clearly states that hostname validation is reported from the active SSL engine, which is the main change.
Description check ✅ Passed The description accurately explains the active SSLEngine reporting change, custom-factory behavior, and test coverage.
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.

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 from c99cd1b to 6dd1b17 Compare August 12, 2026 22:01
@dkropachev
dkropachev force-pushed the fix/report-active-hostname-validation branch from 6dd1b17 to b9096d0 Compare August 12, 2026 22:06
@coderabbitai coderabbitai Bot added P1 and removed P3 labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant