Skip to content

fix(deps): bump tokio-postgres to 0.7.18 - #465

Open
tobyhede wants to merge 4 commits into
mainfrom
fix/cip-4104-tokio-postgres-patch
Open

tobyhede wants to merge 4 commits into
mainfrom
fix/cip-4104-tokio-postgres-patch

Conversation

@tobyhede

Copy link
Copy Markdown
Contributor

Summary

Bumps tokio-postgres in Cargo.lock from 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.toml edits (all manifests already use tokio-postgres = "0.7").

Lockfile changes

  • tokio-postgres 0.7.13 → 0.7.18
  • Companion/transitive bumps pulled in by the resolver: postgres-types 0.2.9 → 0.2.14, postgres-derive 0.4.6 → 0.4.9, whoami 1.6.0 → 2.1.3, wasite 0.1.0 → 1.0.2, phf/phf_shared 0.11.3 → 0.13.1, serde_json 1.0.140 → 1.0.151; added objc2-core-foundation, objc2-system-configuration, zmij
  • libredox 0.1.3 → 0.1.24 (required: whoami 2.x needs a newer libredox than was locked)
  • postgres-protocol (0.6.12) and tokio-postgres-rustls (0.13.0) unchanged

Verification

  • cargo tree -i tokio-postgres --workspace: single version, tokio-postgres v0.7.18
  • cargo check --workspace --all-targets: passes

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".
@tobyhede
tobyhede requested a review from freshtonic September 21, 2026 01:49
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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant