Skip to content

fix(conn): honor backslash escapes in E'' strings when scrubbing - #57

Merged
alexshapalov merged 1 commit into
pgrundev:mainfrom
lofoneh:fix/scrub-e-string-escapes
Sep 21, 2026
Merged

alexshapalov merged 1 commit into
pgrundev:mainfrom
lofoneh:fix/scrub-e-string-escapes

Conversation

@lofoneh

@lofoneh lofoneh commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What and why

Found while fixing #54. In an E'...' string \' is an escaped quote, but the
literal regex ended the string there, so the rest leaked:

before: SELECT E'?'s card for jane.doe' AS x
after:  SELECT '?' AS x

The regex now matches E'...' with backslash escapes before falling back to
standard '...'. Independent of #56 (different lines); either can land first.

Verification

  • New cases fail on main, pass here (escaped quote, escaped backslash, mixed
    ''/\', plain literals, CASE … THEN 'x' stays a plain literal).
  • Scrubber fuzzer green; scripts/gate.sh green.

Checklist

  • scripts/gate.sh passes
  • No PII enters a model.Context / --json / the store — this closes a hole
  • Remaining items n/a.

In an E'...' string `\'` is an escaped quote, but the string-literal regex
ended the literal there, so the rest of it survived scrubbing:
E'it\'s … jane.doe' became E'?'s … jane.doe'.

The regex now matches E'...' (case-insensitive E at a word boundary) with
backslash escapes before falling back to standard '...' literals.
@alexshapalov
alexshapalov merged commit 282ffe8 into pgrundev:main Sep 21, 2026
19 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