Files
Ankur MhatreandClaude Sonnet 5.5 7c677a39d2 Add vuln-scan: Dependency-Check 13.0.0 vs Trivy 0.76.2 vs OSV-Scanner 2.7.1
Same Maven project scanned three ways (pom.xml, SBOM, jars): captured output,
false-positive evidence, suppression files with expiry, CI gate, -Pfixed profile.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b7h4ZNF4BDUpJk3Zou
2026-11-29 02:29:18 +05:30

20 lines
801 B
Python
Executable File

#!/usr/bin/env python3
"""A severity gate for osv-scanner, which has no built-in threshold flag.
gate.py osv.json <minimum-cvss> exits 1 when any finding has a CVSS score >= the minimum
"""
import os, subprocess, sys
HERE = os.path.dirname(os.path.abspath(__file__))
out = subprocess.run([sys.executable, os.path.join(HERE, "normalise.py"), "osv", sys.argv[1]],
capture_output=True, text=True, check=True).stdout
limit = float(sys.argv[2])
bad = []
for line in out.splitlines():
_, comp, vid, score = line.split("\t")
if score and float(score) >= limit:
bad.append((score, vid, comp))
for score, vid, comp in sorted(bad, reverse=True)[:5]:
print(f" {score:>5} {vid} {comp}")
print(f"{len(bad)} finding(s) with CVSS >= {limit}")
sys.exit(1 if bad else 0)