Repository navigation
Fix SQL quoting - #434
Fix SQL quoting#434
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Changed quoting for backslash-bearing substitutions causes schedule mismatches when in-flight instances replay after a binary upgrade, without preserved compatibility or a documented and tested upgrade contract.
1 open issue
What changed in this PR
This PR hardens SQL literal quoting in pg_durable’s result substitution and upgrade tooling, particularly for values containing backslashes and apostrophes.
Changes:
- Replaces ad-hoc Rust quoting with
postgres-protocolescaping. - Adds quoting, injection-prevention, round-trip, and determinism tests.
- Updates the upgrade lifecycle’s Python quoting helper and tests.
| File | Description |
|---|---|
tests/e2e/sql/97_literal_quoting.sql |
Tests substitution on activity connections with nonstandard string settings. |
src/types.rs |
Uses robust literal escaping and adds substitution regression tests. |
src/lib.rs |
Updates test quoting and adds PostgreSQL-backed quoting tests. |
scripts/upgrade_lifecycle.py |
Escapes backslashes using explicit escape-string literals. |
scripts/test_upgrade_lifecycle.py |
Tests the Python literal helper’s escaping behavior. |
Cargo.toml |
Adds the postgres-protocol dependency. |
Cargo.lock |
Records the new direct dependency. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Missing PostgreSQL-backed quoting tests and real N-1 lifecycle validation leave security-sensitive SQL escaping and durable replay compatibility unverified.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Replay-sensitive serialization and PostgreSQL quoting and connection-setting changes require real N-1 upgrade lifecycle and integration validation that could not be run in this review environment.
No open issues 🎉
Review effort: Balanced

Replace ad-hoc quoting with more robust quoting.