Conversation
Addresses GHSA-3gjw-f78c-vvpw (affected >= 0.4.0, < 0.7.18). Lockfile-only change.
tokio-postgres 0.7.18 no longer appends the cause to Error's Display, so integration assertions on err.to_string() saw a bare "db error" and failed on all four PostgreSQL versions. Assert on the structured error instead: assert_db_error reads severity and message off as_db_error(), assert_client_error reads the kind off Display and the detail off source(). The exact customer-visible message text, including the docs/errors.md links, stays pinned. ConfigError::Database is no longer transparent: it renders the cause so Proxy's own logs keep the server's message rather than logging "db error".
tokio-postgres 0.7.18 follows the convention that an error's Display describes only that error, with the cause reached through source(). The previous fix worked against that by re-embedding the cause in ConfigError::Database's Display, and it only covered errors converted into that variant: sites logging a raw tokio_postgres::Error still dropped the server's message. Add ErrorChain, a Display wrapper that walks source(), and use it at every log site that can carry a database error. ConfigError::Database is transparent again. Recording the error as a dyn Error field is not enough: the Structured (JSON) format, the default off a terminal, renders only Display. ErrorChain skips a cause the message already ends with, so variants that embed their cause in Display are not printed twice.
Replace the hand-rolled source() match with the shared helper. Same severity and message are pinned; failures now report what arrived instead of hitting a bare unreachable!().
freshtonic
reviewed
Sep 23, 2026
|
|
||
| ### Fixed | ||
|
|
||
| - **Database error detail in Proxy's logs**: logged database errors again include the message PostgreSQL returned, not just the error kind. The upgraded PostgreSQL client library stopped appending the underlying cause when an error is rendered as text, which left entries such as `Database connection error` reading only `db error`. Proxy now renders the cause itself, so the server's message is back in the log line. |
Contributor
There was a problem hiding this comment.
I think this entry describes a regression that no user saw. The tokio-postgres bump and the ErrorChain fix are both in this PR, so a released Proxy never logged a bare db error. 3.0.1 logs db error: ERROR: … and so does this branch. A reader of the release notes would think that database errors in the logs were broken in a released version.
I suggest that you remove this entry, or merge one sentence into the ### Security entry below. For example: "Logged database errors still include the message from PostgreSQL." Not blocking.
freshtonic
approved these changes
Sep 23, 2026
freshtonic
left a comment
Contributor
There was a problem hiding this comment.
Approving. The dependency bump is correct and the follow-up work is sound.
What I checked
ErrorChaingives the same log text as before the bump. Under 0.7.13,Displayrendereddb error: ERROR: <msg>. NowErrorChainrenders the kind (db error), then:, then theDbErrorsource (ERROR: <msg>).ConfigError::DatabaseandError::Configare#[error(transparent)], so bothDisplayandsource()forward to the inner error and the chain stays correct through the crate wrappers.- No client-facing path sends a
tokio_postgres::Errorto the client. The onlytokio-postgresclients are the schema loader, the EQL version probe and themigrateCLI. Their errors are logged, not converted inerror_to_response, so no client can get a baredb errorin anErrorResponse. - The remaining
err.to_string()log sites (ConnectionTimeout, prometheus, TLS, config reload) cannot contain atokio_postgres::Error, so it is correct to leave them unchanged. assert_db_errorcomparesseverity()andmessage()on theDbError. This is more precise than the old string compare, and the passthrough test no longer needs its own nestedmatch.- All required checks pass on
9eaa4bc.
Non-blocking
- The PR description is out of date. It says "Lockfile-only change; no
Cargo.tomledits", but the branch now also addsErrorChain, changes nine log sites, adds two test helpers and adds CHANGELOG entries. Please update the summary so the squash commit and the release notes match the change. - See the inline comment on the
### FixedCHANGELOG entry. - Small point:
ErrorChainskips a cause when the text rendered so far ends with that cause. A short cause (for exampletimeout) can match the end of an unrelated message and get dropped. This is acceptable for log output. If you want it exact, compare only against the parent's ownDisplay, not the accumulated string. No change is necessary.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps
tokio-postgresinCargo.lockfrom 0.7.13 → 0.7.18 to address GHSA-3gjw-f78c-vvpw (Medium; affected>= 0.4.0, < 0.7.18). Resolves Dependabot alert #55.Lockfile-only change; no
Cargo.tomledits (all manifests already usetokio-postgres = "0.7").Lockfile changes
tokio-postgres0.7.13 → 0.7.18postgres-types0.2.9 → 0.2.14,postgres-derive0.4.6 → 0.4.9,whoami1.6.0 → 2.1.3,wasite0.1.0 → 1.0.2,phf/phf_shared0.11.3 → 0.13.1,serde_json1.0.140 → 1.0.151; addedobjc2-core-foundation,objc2-system-configuration,zmijlibredox0.1.3 → 0.1.24 (required:whoami2.x needs a newerlibredoxthan was locked)postgres-protocol(0.6.12) andtokio-postgres-rustls(0.13.0) unchangedVerification
cargo tree -i tokio-postgres --workspace: single version,tokio-postgres v0.7.18cargo check --workspace --all-targets: passes