Lint rule: SQL built with Format (sql-injection-format)
Security rule, ON: a Format(..) string whose %s lands in a value position of SQL text; identifier positions are not reported.
Read this to see when sql-injection-format reports, which %s positions it leaves alone, and how it differs from sql-injection-concat.
How to run it
drag-lint lint <path> [--profile <name>] [--target-compiler <ver|auto>] [--rule <id>|help] [--disable id1,id2] [--rules-dir <dir>] [--json] [--labels] [--no-preprocess] [--library-db <lib.sqlite>] [--build-config <name>] [--no-budget]
Example:
drag-lint lint <file.pas> --rule sql-injection-format
Full flag list: lint in the CLI reference.
Where to click
No IDE surface: this feature runs from the CLI (see How to run it).
Details
Two security rules, ON by default, severity warning.
sql-injection-format
A string built with Format(..) whose %s is substituted into SQL text. A %s in an identifier position
is NOT reported (a sequence name in GEN_ID(%s, 1), a name after FROM / INTO / UPDATE / JOIN /
TABLE, a select list, an ORDER BY / GROUP BY list): those cannot be parameters. It does not follow a
Format result through a variable (S := Format(..); Q.SQL.Text := S). It is a new id; it does not extend
sql-injection-concat. CWE-89.
weak-tls-version
A weak protocol constant (SSL 2 / SSL 3 / TLS 1.0 / TLS 1.1) assigned or passed as a TLS version. A weak protocol held in a variable is not seen. CWE-327.
drag-lint lint <file.pas> --rule sql-injection-format
drag-lint lint-all --db <project.sqlite> --rule weak-tls-version