Repository navigation
GH-1319: [JDBC] Add hostnameOverride connection property for TLS certificate verification and SNI - #1363
Open
fredjoonpark wants to merge 3 commits into
Open
GH-1319: [JDBC] Add hostnameOverride connection property for TLS certificate verification and SNI#1363fredjoonpark wants to merge 3 commits into
fredjoonpark wants to merge 3 commits into
Conversation
fredjoonpark
requested review from
jbonofre,
laurentgo,
lidavidm and
wgtmac
as code owners
October 15, 2026 23:37
jbonofre
requested changes
Oct 16, 2026
Author
|
@lidavidm @laurentgo @wgtmac @jbonofre any chance we can get this reviewed? |
Member
|
@fredjoonpark I'm resuming the review on this one. |
jbonofre
requested changes
Oct 30, 2026
Member
|
I will rebase, as the CI has been fixed on |
added 2 commits
October 30, 2026 06:14
…S certificate verification and SNI
Normalize hostnameOverride in the builder so an empty or blank value (e.g. from a templated URL) falls back to the connection host instead of failing with an invalid authority. Also skip the override for endpoints when encryption is disabled, and document that it is sent as the gRPC :authority.
jbonofre
force-pushed
the
GH-1319-hostname-override
branch
from
October 30, 2026 06:14
c707cd6 to
7ee704d
Compare
Only apply hostnameOverride to endpoint locations on the same host and port as the connection, so endpoints on other ports are verified against their own hostname. Ignore IPv6 brackets when comparing hosts, since a host set through properties may not have them.
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.
What's Changed
Adds an optional
hostnameOverrideconnection property to the Flight SQL JDBC driver. When TLS is enabled, the driver verifies the server certificate against this hostname and sends it for SNI and as the gRPC:authority, instead of using the host in the JDBC URL. This lets the driver connect with full certificate verification through SSH tunnels, port-forwarding, private endpoints, or IP addresses that don't match the server certificate. Today the only option in those cases isdisableCertificateVerification=true.hostnameOverride(string, default unset) inArrowFlightConnectionProperty, passed fromArrowFlightConnectiontoArrowFlightSqlClientHandler.Builder.Builder.build()callsNettyClientBuilder.overrideHostname(...)when encryption is on. The property is ignored whenuseEncryption=false, and a blank value is treated as unset.getStreams(): the override is applied only when the endpoint host and port match the original connection (host compared case-insensitively, IPv6 brackets ignored). Endpoints at any other location, or any endpoint when the original connection isn't encrypted, are verified against their own hostname, as they are today. This logic is inBuilder.getHostnameOverrideForEndpoint(URI)so it can be unit-tested.docs/source/flight_sql_jdbc_driver.rstnext totlsRootCerts.Example:
Tests
ConnectionTlsHostnameOverrideTest. It uses the existing test certificate, which is issued forlocalhostand has no IP SAN. Its servers bind to127.0.0.1and the tests connect there, so they don't depend on howlocalhostresolves. Failure cases assert that the cause is aCertificateException, not just anySQLException:No subject alternative names present);hostnameOverride=localhost, set in the URL or inProperties, it succeeds with full verification;hostnameOverride=behaves as unset;ArrowFlightSqlClientHandlerBuilderTest: the default is unset and the builder copy keeps the value. The endpoint rule is covered for same host and port, different port, no port, different case, IPv6 with and without brackets, different host, unencrypted connection, blank value, and no override set.ArrowFlightConnectionConfigImplTest: the property is parsed.This change is additive and has no breaking changes.
Closes #1319.