Skip to content

Commit c570e11

Browse files
committed
fix: temporary fix for heuristic dependency handling
1 parent 4fbf160 commit c570e11

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,14 @@ def _should_skip(
9999
Returns True if any result of the dependency heuristic does not match the expected result.
100100
Otherwise, returns False.
101101
"""
102+
mapped_h: dict[Heuristics, list[HeuristicResult]] = {}
102103
for heuristic, expected_result in depends_on:
103-
dep_heuristic_result: HeuristicResult = results[heuristic]
104-
if dep_heuristic_result is not expected_result:
105-
return True
104+
mapped_h.setdefault(heuristic, []).append(expected_result)
105+
106+
for heuristic, exp_results in mapped_h.items():
107+
dep_heuristic_result = results.get(heuristic)
108+
if dep_heuristic_result not in exp_results:
109+
return True
106110
return False
107111

108112
def analyze_source(

0 commit comments

Comments
 (0)