SQL Injection And Parameterization

Guides the one non-negotiable rule for combining SQL with data — pass every value through a bind parameter / prepared statement, and never build SQL by string interpolation, concatenation, f-strings, or `format`. Explains why this beats hand-escaping (OWASP ranks escaping last and "STRONGLY DISCOURAGED," and "CANNOT guarantee" it works), why identifiers (table/column names, ASC/DESC) cannot be parameterized and must be allow-listed against a fixed set, and that placeholder syntax (`?`, `$1`. Auto-invokes when writing or editing any query that embeds a variable or user input, string-building of SQL, dynamic `WHERE`/`ORDER BY`/table or column names, ORM raw-query escape hatches, or on "build this query from input" / "is this safe from injection" / "escape this value" requests.

ctoth 1adef9e 3 files · 26.8 KB Updated

File contents

ctoth/sql-skills-plugin/tree/main/plugins/sql/skills/sql-injection-and-parameterization commit 1adef9e781

Frequently asked questions

npx skillmds@latest add ctoth/sql-injection-and-parameterization