Repository navigation
fix(rules): sql-concat rules ignore prose and identifier interpolation (#662) - #665
Merged
Merged
Conversation
#662) A SQL keyword in a message is not SQL, and identifiers/SET fragments cannot be bound as parameters. Only a value spliced into real SQL (or string concatenation) stays a finding. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: ajianaz <ajianaz@users.noreply.github.com>
ajianaz
force-pushed
the
fix/662-sql-concat-prose-identifiers
branch
from
October 15, 2026 08:05
43dd10e to
fc32e4e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #662.
What
Extends the existing SQL false-positive filter (now also applied to
sec-sql-concat):SELECT..FROM,INSERT INTO,UPDATE x SET,DELETE FROM);format!("Insert failed: {e}")andformat!("Deleted tag '{}'")are suppressed.{x}/${x}in a value position (after=,<,>,LIKE,IN (, a quote,%, or inside aVALUESlist) or"..." + valueconcatenation stays Critical. Identifier and fragment positions (FROM {table},SET {cols},{column} IS NOT NULL) and parameter indexes (?{n}) are suppressed: they cannot be bound as parameters.query += ...keeps being flagged whatever else is on the line.Why
Issue #662: 5 of the 38 Critical/Major false positives found on two real codebases were these rules.
Testing
cargo fmt --check,cargo clippy --all-targets --features tree-sitter -- -D warnings,cargo test --features tree-sitter(1220 passed). New: 4 prose lines, 5 identifier/fragment lines suppressed; 8 injection shapes (Rustformat!, Python f-string, JS template,+concat,LIKE,IN,VALUES) andquery +=still flagged.utekeanduteke-cloud(Critical+Major): the 5 SQL findings are gone (uteke 20 → 15).FROM {table}is no longer reported; static analysis cannot tell, and identifiers cannot be parameterized.