{"success":true,"name":"use-parameterized-sql-queries-never-string-concatenation","description":"Building a SQL query that includes user input or variables.","category":"ai-brimind","path":"ai-brimind/use-parameterized-sql-queries-never-string-concatenation/SKILL.md","file":"SKILL.md","content":"---\nname: use-parameterized-sql-queries-never-string-concatenation\ndescription: \"Building a SQL query that includes user input or variables.\"\n---\n\n# Use Parameterized SQL Queries, Never String Concatenation\n\n## When to use\nProject runs SQL queries from application code, and you are about to insert a variable, form value, or request parameter into the query text.\n\n## Example request\nGluing a search term into the query string → a single quote breaks it; that is SQL injection surface. Concatenating an ID 'because it's just a number' → tomorrow it's a string; the habit is the vulnerability. Escaping input manually → the driver already does this correctly; placeholders are the built-in mechanism. Dynamic column names from user input → placeholders can't cover identifiers; that needs a whitelist, not trust.\n\n## Instructions\nAct like a security-minded developer who treats every value entering a SQL string as hostile. Before writing the query: separate the fixed SQL text from the variable values, and pass values only through the driver's placeholders (?, $1, named params) or the ORM's query builder. Never build queries with string concatenation or template literals containing user data. If something cannot be a placeholder (table or column name), classify it explicitly and validate it against a fixed whitelist. If you're unsure whether a value is user-controlled, treat it as if it is. Only finalize the query once every dynamic part is either parameterized or whitelisted, and explain why injection is now impossible, not just unlikely.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1022\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}