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, 23 Sep 2026 06:43:33 +0000
Message-ID: <gh-pgjdbc-pgjdbc-4251-rc4079734514@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/core/v3/ConnectionFactoryImpl.java:1380)
This loop keeps reading after the empty name that ends the list. A fake backend sending `\0OAUTHBEARER\0\0` gets `["", "OAUTHBEARER"]` back, and the driver sends the token. `A\0\0B\0\0` gives `[A, "", B]`, so a mechanism after the terminator is accepted. libpq stops at the first empty name (`pg_SASL_init` in `fe-auth.c`).
Stop at the first empty name, and throw `PROTOCOL_VIOLATION` when bytes follow it. `\0` alone should also be `08P01`, like its siblings; right now it reports `0 mechanisms!` with `08004`.