pg.ddx.io  GitHub: pgjdbc/pgjdbc (issues + PRs as email threads)  
help / color / mirror / Atom feed
From: artemgavrilov (@artemgavrilov) <noreply+artemgavrilov@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: [pgjdbc/pgjdbc] PR #4512: fix: mask credentials in the JDBC URLs the driver logs
Date: Thu, 29 Oct 2026 16:02:46 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4512@github.com> (raw)

  Before, a password in a JDBC URL could reach the log or an exception message: the driver
  logged the full URL at FINE on every connection and at WARNING for some malformed URLs, and
  put it in the exception for a URL it could not parse. A `user:password@` part, which libpq
  accepts, was read as a part of the host, the port, or the database name and logged too.

  The driver now masks `password` and `sslpassword` in every URL it logs or puts in an exception
  message, refuses `user:password@` before the host using libpq's rule, and does not log other
  parts of a URL that may hold a password. See the commit messages for details.

  Behavior change: URLs with `user:password@` before the host, or with `@` or `/` in a parameter
  name, are refused. Both were broken already, and the docs require such characters to be
  percent-encoded. `user=name@server` and an `@` in a database name are accepted as before.

  Known limitations:
  - As in libpq, a password with a raw `/`, as in `user:1234/word@host`, is read as a port and a
  database name.

This is extraction from https://github.com/pgjdbc/pgjdbc/pull/4251

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing](https://github.com/pgjdbc/pgjdbc/blob/master/CONTRIBUTING.md) document?
* [x] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?

<!-- You can erase any parts of this template not applicable to your Pull Request. -->

### New Feature Submissions:

1. [x] Does your submission pass tests?
2. [x] Does `./gradlew styleCheck` pass ?
3. [ ] Have you added your new test classes to an existing test suite in alphabetical order?

### Changes to Existing Features:

* [x] Does this break existing behaviour? If so please explain.
* [x] Have you added an explanation of what your changes do and why you'd like us to include them?
* [x] Have you written new tests for your core changes, as applicable?
* [x] Have you successfully run tests with your changes locally?


view thread (25+ messages)  latest in thread

Message-ID: <gh-pgjdbc-pgjdbc-4512@github.com>
Permalink:  ../gh-pgjdbc-pgjdbc-4512@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox