diff --git a/docs/superpowers/specs/2026-10-18-guardrails-a11y-split-design.md b/docs/superpowers/specs/2026-10-18-guardrails-a11y-split-design.md index 0c8ff08..0f82192 100644 --- a/docs/superpowers/specs/2026-10-18-guardrails-a11y-split-design.md +++ b/docs/superpowers/specs/2026-10-18-guardrails-a11y-split-design.md @@ -68,7 +68,7 @@ option. `--domain a11y` is now a usage error (exit 2). Applies when the tree has a source file (`SOURCE_EXTS`) or a `.sql` file. Skips test, spec, fixture and mock paths. One finding per (path, line): -when two rules match the same line the first in this order wins, so a +when two rules match the same line the first in this order wins, so an interpolation inside a raw escape stays INJ-SQL-CONCAT (FAIL). | Rule | Sev | Catches | diff --git a/skills/guardrails/references/checks.md b/skills/guardrails/references/checks.md index ee06c36..abcd266 100644 --- a/skills/guardrails/references/checks.md +++ b/skills/guardrails/references/checks.md @@ -32,10 +32,13 @@ Patterns are per language: a Postgres `$1` placeholder, a tagged template (`sql\`…\``, `sql\`…\``), an argv array and test or fixture paths are silent by design. +One finding per line: INJ-SQL-CONCAT wins over INJ-SQL-RAW-UNSAFE when both +match (an interpolation inside a raw escape stays FAIL). + | Rule | Sev | Catches | Fix | |---|---|---|---| -| INJ-SQL-RAW-UNSAFE | WARN | `$queryRawUnsafe`, `$executeRawUnsafe`, `knex.raw`, `sequelize.query`, `Sequelize.literal`, Django `.objects.raw()` / `.extra()`, SQLAlchemy `text()` fed a variable (a variable may hold a constant)| show it is a constant with bound values, else bind them; or the tagged `$queryRaw` | | INJ-SQL-CONCAT | FAIL | a SQL statement (select … from … where, insert into, update … set, delete … where, create/drop/alter) built with `${}`, `+`, an f-string, `%`, `.format`, PHP `$var`, Ruby `#{}` (ActiveRecord `where("… #{}")` included), `format!`, `Sprintf` | placeholders and a parameter list | +| INJ-SQL-RAW-UNSAFE | WARN | `$queryRawUnsafe`, `$executeRawUnsafe`, `knex.raw`, `sequelize.query`, `Sequelize.literal`, Django `.objects.raw()` / `.extra()`, SQLAlchemy `text()` / `sa.text(` / `sqlalchemy.text(` fed a variable (a variable may hold a constant)| show it is a constant with bound values, else bind them; or the tagged `$queryRaw` | | INJ-SQL-DYNAMIC-EXEC | WARN | plpgsql `EXECUTE '…' \|\| x` | `format('… %I %L', …)` and `USING` | | INJ-POSTGREST-FILTER | WARN | supabase-js `.or()`, `.filter()`, `.not()`, `.match()`, `.textSearch()` with an interpolated string, in a file that uses supabase | `.eq()` and friends, validated values | | INJ-NOSQL-OPERATOR | WARN | Mongo `$where` with a string; a filter taken from `req.body`, `req.query` or `req.params` | allowlist the fields, cast to string, `sanitizeFilter` |