code-review-lab / data /rules.json
alirezaaminzadeh's picture
Publish CodeReview Python lab diffs and versioned ruleset
32e0071 verified
Raw
History Blame Contribute Delete
6.35 kB
{
"meta": {
"ruleset_id": "aria-codereview-rules.v1",
"snapshot": "2026-09-20",
"engine": "python-ast",
"semgrep_yaml": "rules/aria-codereview.v1.yml",
"n_rules": 7
},
"rules": [
{
"rule_id": "py-sql-concat",
"family": "sql-injection",
"cwe": "CWE-89",
"severity": "high",
"title": "SQL built by string concatenation",
"title_fa": "\u0633\u0627\u062e\u062a SQL \u0628\u0627 \u0627\u0644\u062d\u0627\u0642 \u0631\u0634\u062a\u0647",
"message": "A database execute call builds SQL from non-constant text. Use a parameter placeholder.",
"message_fa": "\u0641\u0631\u0627\u062e\u0648\u0627\u0646\u06cc execute \u0645\u062a\u0646 SQL \u0631\u0627 \u0627\u0632 \u0631\u0634\u062a\u0647 \u063a\u06cc\u0631\u062b\u0627\u0628\u062a \u0645\u06cc\u200c\u0633\u0627\u0632\u062f. \u0627\u0632 \u067e\u0627\u0631\u0627\u0645\u062a\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.",
"references": [
"https://cwe.mitre.org/data/definitions/89.html"
],
"patch_hint": "cursor.execute(sql_with_placeholder, (value,))"
},
{
"rule_id": "py-cmd-shell",
"family": "command-injection",
"cwe": "CWE-78",
"severity": "high",
"title": "Shell command built from input",
"title_fa": "\u0641\u0631\u0645\u0627\u0646 \u067e\u0648\u0633\u062a\u0647 \u0633\u0627\u062e\u062a\u0647\u200c\u0634\u062f\u0647 \u0627\u0632 \u0648\u0631\u0648\u062f\u06cc",
"message": "A process is started with shell=True or a concatenated command string.",
"message_fa": "\u0641\u0631\u0627\u06cc\u0646\u062f \u0628\u0627 shell=True \u06cc\u0627 \u0631\u0634\u062a\u0647 \u0641\u0631\u0645\u0627\u0646 \u0627\u0644\u062d\u0627\u0642\u200c\u0634\u062f\u0647 \u0634\u0631\u0648\u0639 \u0645\u06cc\u200c\u0634\u0648\u062f.",
"references": [
"https://cwe.mitre.org/data/definitions/78.html"
],
"patch_hint": "subprocess.run([executable, arg], check=False)"
},
{
"rule_id": "py-path-join",
"family": "path-traversal",
"cwe": "CWE-22",
"severity": "high",
"title": "File path built from input",
"title_fa": "\u0645\u0633\u06cc\u0631 \u0641\u0627\u06cc\u0644 \u0633\u0627\u062e\u062a\u0647\u200c\u0634\u062f\u0647 \u0627\u0632 \u0648\u0631\u0648\u062f\u06cc",
"message": "A file is opened from a path joined with caller-controlled text without a base-directory check.",
"message_fa": "\u0641\u0627\u06cc\u0644 \u0627\u0632 \u0645\u0633\u06cc\u0631 \u0627\u0644\u062d\u0627\u0642\u200c\u0634\u062f\u0647 \u0628\u0627 \u0645\u062a\u0646 \u06a9\u0646\u062a\u0631\u0644\u200c\u0634\u062f\u0647 \u0628\u0627\u0632 \u0645\u06cc\u200c\u0634\u0648\u062f \u0648 \u0628\u0631\u0631\u0633\u06cc \u067e\u0648\u0634\u0647 \u067e\u0627\u06cc\u0647 \u0646\u06cc\u0633\u062a.",
"references": [
"https://cwe.mitre.org/data/definitions/22.html"
],
"patch_hint": "resolved = (BASE / name).resolve(); resolved.is_relative_to(BASE)"
},
{
"rule_id": "py-pickle-load",
"family": "insecure-deserialization",
"cwe": "CWE-502",
"severity": "high",
"title": "Unsafe deserializer on input",
"title_fa": "\u0628\u0627\u0631\u06af\u0630\u0627\u0631\u06cc \u0646\u0627\u0627\u0645\u0646 \u0634\u06cc\u0621 \u0627\u0632 \u0648\u0631\u0648\u062f\u06cc",
"message": "pickle, marshal, or yaml.load is applied to data that is not a trusted constant.",
"message_fa": "pickle\u060c marshal \u06cc\u0627 yaml.load \u0631\u0648\u06cc \u062f\u0627\u062f\u0647 \u063a\u06cc\u0631\u062b\u0627\u0628\u062a \u0627\u0639\u0645\u0627\u0644 \u0634\u062f\u0647 \u0627\u0633\u062a.",
"references": [
"https://cwe.mitre.org/data/definitions/502.html"
],
"patch_hint": "json.loads(text) for trusted JSON; do not unpickle request bodies"
},
{
"rule_id": "py-ssrf-url",
"family": "ssrf",
"cwe": "CWE-918",
"severity": "high",
"title": "HTTP fetch of a caller-controlled URL",
"title_fa": "\u0648\u0627\u06a9\u0634\u06cc HTTP \u0627\u0632 URL \u06a9\u0646\u062a\u0631\u0644\u200c\u0634\u062f\u0647",
"message": "urlopen or requests is called with a URL that is not a constant allowlisted host.",
"message_fa": "urlopen \u06cc\u0627 requests \u0628\u0627 URL \u063a\u06cc\u0631\u062b\u0627\u0628\u062a \u0635\u062f\u0627 \u0632\u062f\u0647 \u0634\u062f\u0647 \u0627\u0633\u062a.",
"references": [
"https://cwe.mitre.org/data/definitions/918.html"
],
"patch_hint": "parse the URL and allow only an explicit host list"
},
{
"rule_id": "py-xss-markup",
"family": "xss-template",
"cwe": "CWE-79",
"severity": "medium",
"title": "Unescaped HTML built from input",
"title_fa": "HTML \u0628\u062f\u0648\u0646 escape \u0627\u0632 \u0648\u0631\u0648\u062f\u06cc",
"message": "Markup or autoescape=False wraps text that is not a constant.",
"message_fa": "Markup \u06cc\u0627 autoescape=False \u0645\u062a\u0646 \u063a\u06cc\u0631\u062b\u0627\u0628\u062a \u0631\u0627 \u062f\u0631 HTML \u0645\u06cc\u200c\u06af\u0630\u0627\u0631\u062f.",
"references": [
"https://cwe.mitre.org/data/definitions/79.html"
],
"patch_hint": "html.escape(name) or a template with autoescape on"
},
{
"rule_id": "py-weak-password-hash",
"family": "weak-crypto",
"cwe": "CWE-327",
"severity": "medium",
"title": "Weak hash used as a password digest",
"title_fa": "\u0686\u06a9\u06cc\u062f\u0647 \u0636\u0639\u06cc\u0641 \u0628\u0631\u0627\u06cc \u06af\u0630\u0631\u0648\u0627\u0698\u0647",
"message": "MD5 or SHA1 is applied to a password-like value. This is not a password hasher.",
"message_fa": "MD5 \u06cc\u0627 SHA1 \u0631\u0648\u06cc \u0645\u0642\u062f\u0627\u0631 \u0634\u0628\u06cc\u0647 \u06af\u0630\u0631\u0648\u0627\u0698\u0647 \u0627\u0639\u0645\u0627\u0644 \u0634\u062f\u0647 \u0627\u0633\u062a.",
"references": [
"https://cwe.mitre.org/data/definitions/327.html"
],
"patch_hint": "use a password hasher such as hashlib.scrypt or a vetted library"
}
]
}