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!().
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