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
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
f32c088174
commit
7c677a39d2
Executable
+19
@@ -0,0 +1,19 @@
|
||||
#!/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)
|
||||
Reference in New Issue
Block a user