From da3a71aa7aa0a03734cc6ea0253ac5f0923bba6c Mon Sep 17 00:00:00 2001 From: Carl Flottmann Date: Thu, 7 Aug 2025 13:33:49 +1000 Subject: [PATCH] fix: temporary fix for heuristic dependency handling --- .../checks/detect_malicious_metadata_check.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py b/src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py index 646f7acc3..3f86dfc9f 100644 --- a/src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py +++ b/src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py @@ -100,10 +100,14 @@ def _should_skip( Returns True if any result of the dependency heuristic does not match the expected result. Otherwise, returns False. """ + mapped_h: dict[Heuristics, list[HeuristicResult]] = {} for heuristic, expected_result in depends_on: - dep_heuristic_result: HeuristicResult = results[heuristic] - if dep_heuristic_result is not expected_result: - return True + mapped_h.setdefault(heuristic, []).append(expected_result) + + for heuristic, exp_results in mapped_h.items(): + dep_heuristic_result = results.get(heuristic) + if dep_heuristic_result not in exp_results: + return True return False def analyze_source(