Skip to content

refactor(grpc): remove unused PostgreSQL storage backend (-4 security advisories)#16

Open
hiq-lab wants to merge 1 commit into
mainfrom
remove-dead-postgres-storage
Open

refactor(grpc): remove unused PostgreSQL storage backend (-4 security advisories)#16
hiq-lab wants to merge 1 commit into
mainfrom
remove-dead-postgres-storage

Conversation

@hiq-lab

@hiq-lab hiq-lab commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the unused PostgreSQL storage backend from arvak-grpc. Net
effect on the CI Security Audit: 11 → 8 vulnerabilities (− 4 of
the postgres-chain advisories) without changing any production behaviour,
because the feature was enabled nowhere.

Why now

The Security Audit job on main has been failing since 2026-06-13 on
11 RUSTSEC advisories. Audit of the dependency tree showed that 4 of
them — the entire PostgreSQL chain — come from code that is never
built
:

Advisory Crate Issue
RUSTSEC-2026-0097 rand 0.10.0 unsound with custom logger
RUSTSEC-2026-0178 tokio-postgres 0.7.17 DataRow panic (DoS)
RUSTSEC-2026-0179 postgres-protocol 0.6.11 SCRAM unbounded iter (DoS)
RUSTSEC-2026-0180 postgres-protocol 0.6.11 hstore decode panic

The postgres feature in arvak-grpc has been opt-in since
introduction. grep -r 'features.*postgres' --include='*.toml' across
the whole workspace returned zero matches outside the feature's own
declaration. cargo tree --invert tokio-postgres reports
"did not match any packages" — confirming nothing builds against it.
Despite that, optional deps stay in Cargo.lock for reproducibility,
and cargo audit reads the lock file.

We were paying audit cost for dead code.

What changes

  • Delete crates/arvak-grpc/src/storage/postgres.rs (534 LOC).
  • Drop the postgres feature and tokio-postgres optional dep from
    Cargo.toml.
  • Remove all #[cfg(feature = "postgres")] sites in lib.rs,
    storage/mod.rs, and error.rs.
  • Drop "postgres" from the storage-backend validator in config.rs.
  • Strip postgres mentions from README, config.example.yaml, and
    .env.example.

MemoryStorage (default) and SqliteStorage (feature-gated) remain.
If a PostgreSQL backend is ever needed, a fresh implementation against
a current tokio-postgres release is the right path.

Out of scope

  • pyo3 0.28.2 (2 advisories: RUSTSEC-2026-0176, -0177). Patched in
    pyo3 ≥ 0.28.3 — needs version verification before bumping.
  • rustls-webpki 0.101.7 + 0.103.10 (6 advisories — same 3 issues
    per version). Pulled in transitively via aws-smithy → aws-sdk-* →
    arvak-adapter-braket. Fix path is bumping aws-sdk crates.

Both worth a separate PR each so each fix has clean blame.

Test plan

  • cargo fmt --all clean
  • cargo check --workspace --exclude arvak-python green
  • cargo check -p arvak-grpc --all-features green
  • cargo test -p arvak-grpc --lib: 36 passed, 0 failed
  • Local cargo audit: 11 → 8 vulnerabilities, 5 → 4 warnings
  • Cargo.lock shrunk by 344 lines (whole postgres + transitive
    chain gone)
  • CI: this PR's run

🤖 Generated with Claude Code

The 'postgres' feature flag in arvak-grpc has been opt-in since
introduction and is enabled nowhere in the workspace. The compiled
result: tokio-postgres is in Cargo.lock for reproducibility but
'cargo tree --invert tokio-postgres' confirms it is never actually
built. Despite never being built, the locked transitive chain
contributes 4 of the 11 advisories that have been failing CI's
Security Audit job on main since 2026-06-13:

  - RUSTSEC-2026-0097  rand 0.10.0      unsound with custom logger
  - RUSTSEC-2026-0178  tokio-postgres   DataRow panic (DoS)
  - RUSTSEC-2026-0179  postgres-protocol  unbounded SCRAM iter (DoS)
  - RUSTSEC-2026-0180  postgres-protocol  hstore decode panic (DoS)

We're paying real audit cost for dead code. Remove it.

Changes:
- Delete crates/arvak-grpc/src/storage/postgres.rs (534 LOC).
- Drop the 'postgres' feature and 'tokio-postgres' optional dep from
  Cargo.toml.
- Remove all #[cfg(feature = "postgres")] sites (lib.rs, storage/mod.rs)
  and any(feature = "sqlite", feature = "postgres") → feature = "sqlite".
- Drop the From<tokio_postgres::Error> for Error impl.
- Drop "postgres" from the validator in config.rs.
- README, config.example.yaml, .env.example — strip the postgres
  mentions in the storage-backend documentation.

SQLite remains as the persistent-storage option (feature-gated). If a
PostgreSQL backend is needed later it can be reintroduced cleanly with
a current tokio-postgres release.

Verified:
- cargo fmt --all clean.
- cargo check --workspace --exclude arvak-python green.
- cargo check -p arvak-grpc --all-features green.
- cargo test -p arvak-grpc --lib: 36 passed, 0 failed.
- Local cargo audit: 11 → 8 vulnerabilities, 5 → 4 warnings.
- Cargo.lock shrunk by 344 lines.

Remaining audit findings (out of scope for this PR):
- pyo3 0.28.2 × 2 (RUSTSEC-2026-0176, -0177) — patched in 0.28.3+,
  needs verification that a fixed release exists.
- rustls-webpki 0.101.7 + 0.103.10 × 3 each — pulled in transitively
  via aws-smithy → aws-sdk-* → arvak-adapter-braket. Fix path is
  bumping aws-sdk crates to versions with patched rustls-webpki.
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