pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Generated role configuration literals must be safe with standard_conforming_strings off

Open Goldziher opened this issue 1 month ago • 1 comments

Parent: #627

Role configuration values are external manifest input and must be quoted independently of the target's standard_conforming_strings setting.

A focused reproduction with a value containing a backslash followed by an apostrophe shows the generated SQL uses a plain quoted literal that only doubles apostrophes. With standard_conforming_strings=off, the backslash can change how the following quote is parsed.

Required behavior: use a quoting form that is safe under both settings (for example an explicitly escaped literal strategy) and add a negative test using a backslash-plus-quote payload that proves no additional statement or clause can be injected.

Goldziher avatar Oct 09 '26 09:10 Goldziher

Tracked under #627. A proposed implementation is in #637, which is still under discussion. Closing this sub-issue since it is covered by the #627 umbrella.

tianzhou avatar Oct 15 '26 03:10 tianzhou