From: vlsi (@vlsi) <noreply+vlsi@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: Re: [pgjdbc/pgjdbc] PR #4512: fix: mask credentials in the JDBC URLs the driver logs
Date: Thu, 05 Nov 2026 12:10:27 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4512-rc4480244899@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-4512@github.com>
References: <gh-pgjdbc-pgjdbc-4512@github.com>
(on pgjdbc/src/test/java/org/postgresql/test/jdbc2/PGPropertyTest.java)
**minor**: the tests pass when the URL is absent from the message, and two paths have no test
`setUrlMasksCredentialsInItsError`, `malformedUrlWarningsMaskCredentials`, `connectingWithUrlMasksCredentials`, and `getConnectionMasksCredentialsInItsLog` check only that the secret is missing and that some record contains a fixed phrase. A message of `URL invalid` with no URL, or a record that drops the query string, passes all of them. Please assert the whole expected text, as `unableToParseUrlMasksCredentials` already does, for example `assertEquals("URL invalid jdbc:postgresql://localhost/a/b?password=***&sslpassword=***", e.getMessage())`.
The phrase checks can also be met by another test. `SslTest` is `@Execution(ExecutionMode.CONCURRENT)`, so it can run while this class holds the `org.postgresql.Driver` logger at `FINE`, and its connections log `Connecting with URL` too. Comparing with the URL that carries this test's closed port makes the check specific. `@Isolated`, as `BatchDeadlockTest` uses for the same reason, also stops these tests from silencing the other tests' records through `setUseParentHandlers(false)`.
Untested paths:
- the success record `Created a {0} for {1} at {2}` in `BaseDataSource.getConnection`: no test opens a connection with `sslpassword` set at `FINE`, so it can log the unmasked URL and every test still passes. It needs a server, so it belongs with the server-backed data-source tests.
- the `jdbc:postgresql:<dbname>` form (no `//`) with a database name that fails to decode, such as `jdbc:postgresql:db%zz`: the PR rewrites that `catch`, and no test parses it and expects `null`.