Skip to content

Update Python SQLi rule for single-var injections

Connor Gilbert requested to merge connorgilbert/py-sqli-single-var into main

What does this MR do?

Update python_sql_rule-hardcoded-sql-expression to catch injections with a single variable, while adding some exclusions to avoid catching cases where string literals are being combined.

What are the relevant issue numbers?

Add single-variable string concatenation case t... (gitlab-org/gitlab#463359 - closed)

Does this MR meet the acceptance criteria?

  • The test cases cover both positive and negative cases and are also annotated with appropriate semgrep annotations:
    • For positive cases: // ruleid: ...
    • For negative cases: // ok: ....
  • Following metadata fields exist for the rule(s) added/updated in this MR:
    • owasp with both 2017 and 2021 mappings.
    • category: "security"
    • cwe
    • shortDescription
    • security-severity
  • The message field is valid and contains a secure code example.
  • Applicable license is mentioned in the rule if embedded/taken from external source.
  • Relevant labels including workflow labels are appropriately selected.
Edited by Connor Gilbert

Merge request reports