Skip to content

Fix SQL quoting - #434

Merged
Thom Chiovoloni (thomcc-work) merged 3 commits into
mainfrom
thomcc/fix-quoting
Oct 30, 2026
Merged

Thom Chiovoloni (thomcc-work) merged 3 commits into
mainfrom
thomcc/fix-quoting

Conversation

@thomcc-work

Copy link
Copy Markdown
Contributor

Replace ad-hoc quoting with more robust quoting.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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-protocol escaping.
  • 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

Comment thread src/types.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

@thomcc-work
Thom Chiovoloni (thomcc-work) merged commit 6416a44 into main Oct 30, 2026
20 checks passed
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.

2 participants