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
20 changes: 13 additions & 7 deletions scripts/security/filter_binskim_sarif.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,19 @@ def _normalize_invocations(sarif: dict, notif_suppressions: list[dict]) -> int:
if not matched:
continue
notif["level"] = "note"
notif.setdefault("suppressions", []).append(
{
"kind": "external",
"status": "accepted",
"justification": matched.get("reason", ""),
}
)
# NOTE: SARIF 2.1.0 does not allow `suppressions` on
# toolConfigurationNotifications (only on results). The audit
# trail lives in binskim_suppressions.json; here we just record
# the justification in the notification message for visibility.
reason = matched.get("reason", "")
if reason:
msg = notif.setdefault("message", {})
base_text = msg.get("text") or msg.get("id", "")
msg["text"] = (
f"{base_text}\n[binskim_suppressions.json] {reason}"
if base_text
else f"[binskim_suppressions.json] {reason}"
)
demoted += 1
remaining_errors = sum(
1
Expand Down
Loading