Summary
The built-in driver's mTLS bug was fixed upstream in tabularis#666: build_postgres_tls_connector in src-tauri/src/pool_manager.rs hardcoded .with_no_client_auth() across all SSL modes, so PostgreSQL servers requiring client-side certificate authentication (e.g. Google Cloud SQL with mTLS enabled) rejected connections with connection requires a valid client certificate. That PR added load_client_auth_from_pem and wires ssl_cert/ssl_key into .with_client_auth_cert(...).
This plugin has the same gap. ConnectionParams already carries ssl_cert and ssl_key (src/models.rs:19-20, populated at src/models.rs:47-48), but build_tls_connector in src/client.rs:418-447 never reads them — every branch ends in .with_no_client_auth() regardless of ssl_mode. So client-cert/mTLS connections fail here the same way the built-in driver failed before #666.
Proposed fix
Port the approach from tabularis#666 into src/client.rs:
- Add a
load_client_auth_from_pem (or similar) helper that parses ssl_cert/ssl_key PEM files via rustls_pemfile/rustls::pki_types, mirroring the existing load_roots_from_pem helper (src/client.rs:451-469).
- In
build_tls_connector, when both ssl_cert and ssl_key are supplied, call .with_client_auth_cert(...) instead of .with_no_client_auth() on the relevant ClientConfig::builder() chains (there are two: the verify-ca/verify-full custom-verifier branch and the platform-verifier branch).
- Add unit tests covering client cert loading and connector configuration, matching
src-tauri/src/pool_manager_tests.rs from the upstream PR.
- Confirm whether
ssl_cert/ssl_key should also factor into connection pool cache keying (per src/client.rs's pool caching by host:port:database:user:startup_script, noted in this repo's CLAUDE.md) — the upstream PR included ssl_cert/ssl_key in build_connection_key.
Per this repo's parity mandate, behavior should match the built-in driver's fixed implementation exactly, not diverge from it.
Summary
The built-in driver's mTLS bug was fixed upstream in tabularis#666:
build_postgres_tls_connectorinsrc-tauri/src/pool_manager.rshardcoded.with_no_client_auth()across all SSL modes, so PostgreSQL servers requiring client-side certificate authentication (e.g. Google Cloud SQL with mTLS enabled) rejected connections withconnection requires a valid client certificate. That PR addedload_client_auth_from_pemand wiresssl_cert/ssl_keyinto.with_client_auth_cert(...).This plugin has the same gap.
ConnectionParamsalready carriesssl_certandssl_key(src/models.rs:19-20, populated atsrc/models.rs:47-48), butbuild_tls_connectorinsrc/client.rs:418-447never reads them — every branch ends in.with_no_client_auth()regardless ofssl_mode. So client-cert/mTLS connections fail here the same way the built-in driver failed before #666.Proposed fix
Port the approach from tabularis#666 into
src/client.rs:load_client_auth_from_pem(or similar) helper that parsesssl_cert/ssl_keyPEM files viarustls_pemfile/rustls::pki_types, mirroring the existingload_roots_from_pemhelper (src/client.rs:451-469).build_tls_connector, when bothssl_certandssl_keyare supplied, call.with_client_auth_cert(...)instead of.with_no_client_auth()on the relevantClientConfig::builder()chains (there are two: theverify-ca/verify-fullcustom-verifier branch and the platform-verifier branch).src-tauri/src/pool_manager_tests.rsfrom the upstream PR.ssl_cert/ssl_keyshould also factor into connection pool cache keying (persrc/client.rs's pool caching byhost:port:database:user:startup_script, noted in this repo's CLAUDE.md) — the upstream PR includedssl_cert/ssl_keyinbuild_connection_key.Per this repo's parity mandate, behavior should match the built-in driver's fixed implementation exactly, not diverge from it.