Repository navigation
GH-1500: [JDBC] Harden trustStore and tlsRootCerts handling for blank values and missing password - #1501
Merged
Conversation
… 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.
lidavidm
approved these changes
Nov 18, 2026
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
Follow-up to #1496 (#1499).
trustStoreandtlsRootCertsvalues as unset (null) inArrowFlightConnectionConfigImplandArrowFlightSqlClientHandler.Builder(consistent withhostnameOverride), so empty query parameters or blank optional properties (e.g.,?trustStore=&useSystemTrustStore=trueor?tlsRootCerts=&trustStore=...) do not shadow fallback trust sources or fail trying to open an empty path.trustStorePassword != nullinArrowFlightSqlClientHandler.Builder#build()before callingClientAuthenticationUtils.getCertificateStream(...), so configuringtrustStorewithouttrustStorePasswordthrowsSQLException(wrappingIllegalArgumentException) and closes the connection allocator instead of leaking an uncaughtNullPointerException.ArrowFlightSqlClientHandler.Builder#withSystemTrustStore,#withTrustStorePath, and#withTlsRootCertificates, and clarify precedence and blank-value handling indocs/source/flight_sql_jdbc_driver.rst.ConnectionTlsTest#testGetAuthenticatedEncryptedConnectionWithKeyStoreBadPasswordto assert theIOException->UnrecoverableKeyExceptioncause chain, and add unit/connection tests for blanktrustStore/tlsRootCertsand missingtrustStorePassword.Tests
ConnectionTlsTest,ConnectionTlsRootCertsTest,ConnectionTlsHostnameOverrideTest,ConnectionMutualTlsTest,ArrowFlightSqlClientHandlerBuilderTest, andArrowFlightConnectionConfigImplTeston JDK 17, 21, and 25, plusspotless:checkandcheckstyle:check.Closes #1500.