docs(guardrails): checks.md injection precedence and row order, spec grammar
This commit is contained in:
1 parent
63a88bc91d
commit
274396da6e
2 files changed
+5
-2
No files matched your search
@@ -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 |
|
||||
|
||||
@@ -32,10 +32,13 @@ Patterns are per language: a Postgres `$1` placeholder, a tagged template
|
||||
(`sql\`…\``, `sql<T>\`…\``), 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` |
|
||||
|
||||
Reference in new issue
Block a user