Repository navigation
dbconn: bump pgx to v5.12.0 and follow its libpq DSN grammars - #344
Conversation
pgx now parses keyword/value strings and URLs exactly as libpq does, so the copied sslmode scanners follow the same grammars; otherwise pg-sprite could honor an sslmode pgx never applied instead of enforcing verify-full on RDS.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
🤖 Reviewed by Jash’s AI agent (Codex) at No blockers found in the six-file diff. I compared both scanners with pgx v5.12.0’s actual The differential accepted/rejected-input tests and the repeated-sslmode RDS regression directly exercise the reason for this dependency bump. Non-blocking suggestion at Validation: all 17 reported CI checks passed, including PostgreSQL 14–18 integration jobs, Supabase, smoke, lint, and unit tests. I did not run local tests or perform a live TLS handshake; the parser comparison above was a source review. |
A fixed corpus only proves the cases someone thought of; the fuzz target holds the copied grammars to pgx for any string pgx parses.
|
🤖 Adversarial review response — created by Kiran's code review agent (Amp, Claude Opus 4.6) — pull/344, follow-up commit The one finding is fixed in the follow-up commit; nothing is deferred.
Source: block/pg-sprite#344, review comment 6779932891 and review 5849844445 at head |
Bump
github.com/jackc/pgx/v5to v5.12.0 and make pg-sprite's copied connection-string scanners read sslmode exactly the way the new pgx does.Why
pgx 5.11 replaced
net/urlwith a libpq-exact URI parser, and pgx 5.12 made keyword/value parsing libpq-exact too. pg-sprite reads the connection string itself to tell whether the caller chose an sslmode, because pgx's parsed config can't tell a chosen mode from its default. On an RDS/Aurora endpoint that answer decides between honoring the caller's mode and enforcing verify-full with the embedded bundle. The Renovate bump (#324) failsTestKeywordDSNSettingAgreesWithPGX. Its URL tests still pass, but they don't cover the new rules, and on those rules the old scanner can report a mode that pgx never applied.What
go.mod/go.sum: pgx v5.10.0 → v5.12.0 (puddle v2.2.3, x/sync v0.22.0, x/text v0.41.0 come with it;go mod tidyalso drops the stale go-spew and go-difflib indirect entries).parseKeywordValueSettings. A backslash escapes any character and is dropped. A trailing backslash in an unquoted value ends the value. An unterminated quote, an empty key, whitespace inside a key, or a NUL byte fails the string.dsn_url.go) follows pgx v5.12.0'sparseURLSettings. The last occurrence of a repeated key wins.ssl=truemeans sslmode=require.#and+are ordinary characters. Components are percent-decoded with libpq's rules, spaces trimmed. The user info ends at the first@before any/. Anything pgx rejects reads as no sslmode.dsnNamesSSLModetable and the password agreement test get cases for each changed rule. A newTestConfigureTLScase checks that the repeated-sslmode URL below gets auto-TLS.Before / after
On an RDS endpoint, a URL that sets sslmode twice and leaves the last one empty runs with pgx's default (prefer) under pgx 5.12. Before this change, pg-sprite read the first value, treated the mode as the caller's choice, and kept prefer's plaintext fallback. After it, pg-sprite reads the same value pgx does, sees no mode selected, and enforces verify-full. Keyword/value strings with no repeated keys and URLs with one sslmode behave as before.
The failing CI case is a keyword/value string,
host=db password=a\ b sslmode=disable. pgx 5.12 reads the password asa band the old scanner readsa\ b. Both read sslmodedisable, so only the password disagrees.References
🤖 Generated with Amp (Claude Opus 4.6)