Which SSL settings win in DataGrip when the SSH/SSL tab and Advanced JDBC properties disagree?
0 reputation · 05 Dec 2021, 07:07 UTC
0 reputation · 05 Dec 2021, 07:07 UTC
I am configuring a PostgreSQL data source in DataGrip and want strict TLS certificate validation, including hostname checking. The data source dialog offers an SSH/SSL tab with fields for a CA certificate and a server-certificate verification toggle, while the Advanced tab lets me set driver-level properties such as sslmode and sslrootcert directly.
My understanding is that the GUI fields are translated into JDBC connection properties when the session opens, but I cannot find documentation describing what happens when both layers are populated with conflicting values. For example, if the GUI verification toggle is off but sslmode=verify-full is set in Advanced (or the reverse), the effective behavior is unclear, and it may differ between the bundled PostgreSQL driver and MySQL Connector/J, or between driver versions that DataGrip downloads independently of the IDE release.
A related concern is that a connection can report SSL as enabled while only encrypting, skipping chain and hostname validation entirely, so I do not want to rely on the checkbox state as evidence of identity checking.
Is there a documented precedence rule between the SSH/SSL tab fields and Advanced driver properties? Does DataGrip expose the final JDBC URL or merged property set sent to the driver so I can verify which values actually applied? And is the answer stable across driver versions, or must it be re-checked after each driver update?
35275 reputation · 05 Dec 2021, 16:16 UTC
There is no formally documented precedence contract, but in practice the driver-level properties win. DataGrip translates the SSH/SSL tab fields into JDBC URL parameters or connection properties when the session opens, and the pgjdbc driver resolves the final URL itself. An explicit sslmode in the Advanced tab (or in a custom JDBC URL) is what the driver actually acts on. Treat this as well-established inferred behavior, not a guaranteed specification.
sslmode=verify-full: the Advanced value should win. verify-full enforces chain and hostname validation regardless of the checkbox state.sslmode=require: the weaker mode governs. The GUI may still write sslrootcert, but with require the pgjdbc driver encrypts without validating the certificate chain or hostname. This is the dangerous direction: the GUI looks strict while the connection is not.One more override to know about: a custom sslfactory property can silently bypass sslmode-based validation entirely in pgjdbc, so check Advanced for that too.
DataGrip builds the final JDBC URL from the General and SSL fields plus Advanced properties, and the URL field on the General tab updates as you edit. That generated URL is the closest thing to a merged property view the IDE exposes. Note that pg_stat_ssl and any "SSL enabled" indicator confirm encryption only — never validation — so they cannot answer your question.
sslmode=verify-full and sslrootcert pointing at your CA.verify-full must fail; if it connects, the Advanced value lost.sslrootcert at a wrong or empty CA file. A genuinely verifying connection must fail; encryption-only modes will still succeed.psql using the same sslmode/sslrootcert to confirm identical behavior outside DataGrip.Not guaranteed. DataGrip downloads and updates JDBC drivers independently of the IDE release, and duplicate-parameter merging between GUI-generated and Advanced properties is version-sensitive. The answer also does not transfer to other drivers — MySQL Connector/J uses different properties (sslMode, trustCertificateKeyStoreUrl) with its own resolution rules. Re-run the negative test above after any driver update; it takes minutes and is the only reliable evidence.
For strict validation, set sslmode=verify-full and sslrootcert explicitly in Advanced, leave the GUI toggle consistent with that intent, and prove it with the hostname-mismatch test. Never treat the checkbox or a successful connection as evidence of identity checking.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.