Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rules:
- id: cortexward-sql-injection-format-string
languages: [python]
severity: ERROR
message: >-
Possible SQL injection: user-controlled input is directly formatted
into a SQL query. Use parameterized queries instead.
metadata:
cwe: "CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection)"
patterns:
- pattern-either:
- pattern: $CURSOR.execute(f"...{$INPUT}...")
- pattern: $CURSOR.execute("..." + $INPUT)
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,13 @@
rules_dir = _rules_dir()
assert rules_dir.is_dir()
names = {p.name for p in rules_dir.iterdir()}
assert names == {
"ssrf.yml",
"template_injection.yml",
"hardcoded_credentials.yml",
"jwt_signature_bypass.yml",
}
assert names == {

Check failure on line 271 in packages/cortexward-scanners/tests/unit/scanners/test_semgrep_scanner.py

View workflow job for this annotation

GitHub Actions / Lint · Type · Test (py3.13)

ruff (invalid-syntax)

packages/cortexward-scanners/tests/unit/scanners/test_semgrep_scanner.py:271:1: invalid-syntax: unindent does not match any outer indentation level

Check failure on line 271 in packages/cortexward-scanners/tests/unit/scanners/test_semgrep_scanner.py

View workflow job for this annotation

GitHub Actions / Lint · Type · Test (py3.12)

ruff (invalid-syntax)

packages/cortexward-scanners/tests/unit/scanners/test_semgrep_scanner.py:271:1: invalid-syntax: unindent does not match any outer indentation level

Check failure on line 271 in packages/cortexward-scanners/tests/unit/scanners/test_semgrep_scanner.py

View workflow job for this annotation

GitHub Actions / Lint · Type · Test (py3.11)

ruff (invalid-syntax)

packages/cortexward-scanners/tests/unit/scanners/test_semgrep_scanner.py:271:1: invalid-syntax: unindent does not match any outer indentation level
"ssrf.yml",
"template_injection.yml",
"hardcoded_credentials.yml",
"jwt_signature_bypass.yml",
"sql_injection.yml",
}

def test_rule_id_strips_the_directory_path_prefix(self) -> None:
assert (
Expand All @@ -297,3 +298,3 @@
def test_cwe_from_metadata_returns_none_for_a_malformed_cwe_field(self) -> None:
assert _cwe_from_metadata({"cwe": "not-a-cwe-string"}) is None
assert _cwe_from_metadata({"cwe": 798}) is None
Loading