From: vlsi (@vlsi) <noreply+vlsi@github.com>
To: pgjdbc/pgjdbc <noreply+pgjdbc-pgjdbc@github.com>
Subject: Re: [pgjdbc/pgjdbc] PR #4251: OAuth implementation
Date: Wed, 09 Sep 2026 15:45:36 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4251-rc3970363298@github.com> (raw)
In-Reply-To: <gh-pgjdbc-pgjdbc-4251@github.com>
References: <gh-pgjdbc-pgjdbc-4251@github.com>
(on pgjdbc/src/main/java/org/postgresql/ds/common/BaseDataSource.java:1610)
This is the third blocking finding. `getUrl()` builds its query string from every `PGProperty` that is set, so `oauthToken` and `oauthClientSecret` go into it. `password` is kept out of that URL by design, since it lives in a separate field rather than in `properties`, and these two secrets do not get the same treatment.
`getUrl()` is not only a bean getter. `getConnection()` logs it at `FINE` on every success and on every failure, and `Driver.connect` logs the same URL again. With a real Keycloak token on a plain `PGSimpleDataSource`:
```text
org.postgresql.Driver.connect: Connecting with URL: jdbc:postgresql://127.0.0.1:15433/test?...&oauthToken=<<<THE-TOKEN>>>&sslmode=disable
org.postgresql.ds.common.BaseDataSource.getConnection: Created a Non-Pooling DataSource ... at ...&oauthToken=<<<THE-TOKEN>>>...
```
The two properties need the treatment `password` gets: excluded from `getUrl()`, and redacted wherever a URL is logged.
This also puts the `char[]` handling in perspective. On the `oauthToken` path the secret is a `String` in `Properties` for the lifetime of the DataSource, and `toCharArray()` zeroes a copy, so the wiping helps only the provider path.
Smaller, on the same block: `setOAuthTokenProviderClassName` is the only one of the twelve new setters taking `@Nullable String`, and `getOAuthToken` yields the bean property `OAuthToken` rather than `oauthToken`, which `PGPropertyTest.dataSourceProperties` tolerates only because it indexes case-insensitively.