Skip to content

Commit da3a71a

Browse files
committed
fix: temporary fix for heuristic dependency handling
1 parent 6329041 commit da3a71a

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
@@ -100,10 +100,14 @@ def _should_skip(
100100
Returns True if any result of the dependency heuristic does not match the expected result.
101101
Otherwise, returns False.
102102
"""
103+
mapped_h: dict[Heuristics, list[HeuristicResult]] = {}
103104
for heuristic, expected_result in depends_on:
104-
dep_heuristic_result: HeuristicResult = results[heuristic]
105-
if dep_heuristic_result is not expected_result:
106-
return True
105+
mapped_h.setdefault(heuristic, []).append(expected_result)
106+
107+
for heuristic, exp_results in mapped_h.items():
108+
dep_heuristic_result = results.get(heuristic)
109+
if dep_heuristic_result not in exp_results:
110+
return True
107111
return False
108112

109113
def analyze_source(

0 commit comments

Comments
 (0)