Skip to content

v1.0.6

Choose a tag to compare

@jtayal-stripe jtayal-stripe released this 03 Jul 06:45
· 3 commits to main since this release
v1.0.6
4ff84db

Security fix

Escapes enum labels in generated SQL to prevent a second-order SQL injection.

Enum labels were interpolated into generated DDL using raw fmt.Sprintf("'%s'", val). A label containing a single quote could break out of the string literal and inject arbitrary SQL, which then executes with the plan runner's (often superuser) privileges when pg-schema-diff generates migration SQL — enabling RCE via COPY ... TO PROGRAM.

All three enum sinks (CREATE TYPE ... AS ENUM, ALTER TYPE ... ADD VALUE, and the BEFORE ordering clause) now route through a new EscapeLiteral helper that doubles single quotes and strips null bytes.

See #295 for details and test evidence.

Recommendation: upgrade to v1.0.6, especially if you run pg-schema-diff against databases where lower-privileged users can create enum types.