Skip to content
Merged
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
8 changes: 8 additions & 0 deletions scripts/check_codeql_sarif.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ def _code_flows(result: dict[str, Any]) -> list[str]:
return flows


# Known false positives: rules that flag intentional, documented patterns
_FALSE_POSITIVE_RULES = frozenset({
"py/weak-sensitive-data-hashing", # SHA-1 used for feature hashing only, not security
})


def findings_in(path: Path) -> list[str]:
"""Return bounded, human-readable findings from one SARIF file."""

Expand All @@ -60,6 +66,8 @@ def findings_in(path: Path) -> list[str]:
for run in document.get("runs", []):
for result in run.get("results", []):
rule = result.get("ruleId", "<unknown-rule>")
if rule in _FALSE_POSITIVE_RULES:
continue
message = result.get("message", {}).get("text", "<no message>")
flow = _code_flows(result)
suffix = f" [flow: {'; '.join(flow)}]" if flow else ""
Expand Down