Skip to content

GH-1500: [JDBC] Harden trustStore and tlsRootCerts handling for blank values and missing password - #1501

Merged
jbonofre merged 1 commit into
apache:mainfrom
jbonofre:gh-1500-jdbc-truststore-hardening
Nov 19, 2026
Merged

jbonofre merged 1 commit into
apache:mainfrom
jbonofre:gh-1500-jdbc-truststore-hardening

Conversation

@jbonofre

Copy link
Copy Markdown
Member

What's Changed

Follow-up to #1496 (#1499).

  • Treat blank trustStore and tlsRootCerts values as unset (null) in ArrowFlightConnectionConfigImpl and ArrowFlightSqlClientHandler.Builder (consistent with hostnameOverride), so empty query parameters or blank optional properties (e.g., ?trustStore=&useSystemTrustStore=true or ?tlsRootCerts=&trustStore=...) do not shadow fallback trust sources or fail trying to open an empty path.
  • Validate trustStorePassword != null in ArrowFlightSqlClientHandler.Builder#build() before calling ClientAuthenticationUtils.getCertificateStream(...), so configuring trustStore without trustStorePassword throws SQLException (wrapping IllegalArgumentException) and closes the connection allocator instead of leaking an uncaught NullPointerException.
  • Sync Javadoc on ArrowFlightSqlClientHandler.Builder#withSystemTrustStore, #withTrustStorePath, and #withTlsRootCertificates, and clarify precedence and blank-value handling in docs/source/flight_sql_jdbc_driver.rst.
  • Tighten ConnectionTlsTest#testGetAuthenticatedEncryptedConnectionWithKeyStoreBadPassword to assert the IOException -> UnrecoverableKeyException cause chain, and add unit/connection tests for blank trustStore/tlsRootCerts and missing trustStorePassword.

Tests

  • Ran ConnectionTlsTest, ConnectionTlsRootCertsTest, ConnectionTlsHostnameOverrideTest, ConnectionMutualTlsTest, ArrowFlightSqlClientHandlerBuilderTest, and ArrowFlightConnectionConfigImplTest on JDK 17, 21, and 25, plus spotless:check and checkstyle:check.

Closes #1500.

… blank values and missing password

Follow-up to apache#1496 (apache#1499).

- Treat blank `trustStore` and `tlsRootCerts` values as unset (`null`) in
  `ArrowFlightConnectionConfigImpl` and `ArrowFlightSqlClientHandler.Builder`
  so empty query parameters or blank optional properties do not shadow
  fallback trust sources or fail trying to open an empty path.
- Validate `trustStorePassword != null` in `ArrowFlightSqlClientHandler.Builder#build()`
  before loading `trustStore` so a missing password throws `SQLException`
  (wrapping `IllegalArgumentException`) and triggers allocator cleanup
  instead of leaking an uncaught `NullPointerException`.
- Sync Javadoc on `withSystemTrustStore`, `withTrustStorePath`, and
  `withTlsRootCertificates` and clarify parameter docs in
  `docs/source/flight_sql_jdbc_driver.rst`.
- Tighten `ConnectionTlsTest#testGetAuthenticatedEncryptedConnectionWithKeyStoreBadPassword`
  to assert the keystore password failure cause, and add tests for blank
  `trustStore`/`tlsRootCerts` and missing `trustStorePassword`.

Closes apache#1500.
@jbonofre jbonofre added the bug-fix PRs that fix a big. label Nov 18, 2026
@jbonofre
jbonofre requested a review from wgtmac as a code owner November 18, 2026 09:57
@github-actions github-actions Bot added this to the 20.0.0 milestone Nov 18, 2026
@jbonofre
jbonofre merged commit e8f68dd into apache:main Nov 19, 2026
22 of 23 checks passed
@jbonofre
jbonofre deleted the gh-1500-jdbc-truststore-hardening branch November 19, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JDBC] Harden trustStore and tlsRootCerts handling for blank values and missing password

2 participants