Skip to content

Commit 60d5ec2

Browse files
committed
chore: check that the OSV vulnerability ID is not None
Signed-off-by: behnazh-w <[email protected]>
1 parent 9bdde99 commit 60d5ec2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,15 +310,15 @@ def run_check(self, ctx: AnalyzeContext) -> CheckResultData:
310310
logger.debug("Unable to get a valid response from %s: %s", self.osv_query_url, error)
311311
if res_obj:
312312
for vuln in res_obj.get("vulns", {}):
313-
v_id = json_extract(vuln, ["id"], str)
314-
result_tables.append(
315-
MaliciousMetadataFacts(
316-
known_malware=f"https://osv.dev/vulnerability/{v_id}",
317-
result={},
318-
detail_information=vuln,
319-
confidence=Confidence.HIGH,
313+
if v_id := json_extract(vuln, ["id"], str):
314+
result_tables.append(
315+
MaliciousMetadataFacts(
316+
known_malware=f"https://osv.dev/vulnerability/{v_id}",
317+
result={},
318+
detail_information=vuln,
319+
confidence=Confidence.HIGH,
320+
)
320321
)
321-
)
322322
if result_tables:
323323
return CheckResultData(
324324
result_tables=result_tables,

0 commit comments

Comments
 (0)