You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix SQL sanitizer bugs with dollar-quoted strings and placeholder overflow
The simple-protocol SQL sanitizer treated $N found inside PostgreSQL
dollar-quoted strings ($$...$$ and $tag$...$tag$) as placeholders and
substituted them into what PostgreSQL considers literal text. A crafted
arg value could then close the dollar-quote from inside and run
arbitrary SQL (see the new proof-of-concept test in query_test.go).
The lexer now recognizes dollar-quoted strings using PostgreSQL's tag
grammar (from scan.l) and preserves their contents verbatim.
Placeholder numbers are also clamped at MaxInt32 rather than silently
overflowing. Previously "$92233720368547758070" wrapped to -10; if the
wrap had landed on a valid positive index it would have aliased a
different argument.
Adds unit tests, fuzz seeds, and an integration PoC.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments