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

38 lines
1.6 KiB
YAML

# A CI gate that uses all three layers. NOT executed on a CI runner for the post: the commands
# below are the ones run by scripts/run-all.sh (output/11-gating-and-fix.txt shows their exit codes).
name: vuln-scan
on:
pull_request:
schedule:
- cron: "17 3 * * *" # nightly re-scan: the database changes even when the code does not
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { distribution: temurin, java-version: "25" }
# 1. Build, and write the SBOM next to the artifact.
- run: mvn -B package cyclonedx:makeAggregateBom
# 2. Fast gate on every pull request: Trivy reads the SBOM, fails only on CRITICAL.
- run: >
docker run --rm -v "$PWD":/src:ro ghcr.io/aquasecurity/trivy:0.76.2
sbom --exit-code 1 --severity CRITICAL --ignorefile /src/config/trivyignore.yaml /src/target/bom.json
# 3. Second opinion from a different database. osv-scanner has no severity flag, so scripts/gate.py applies one.
- run: |
osv-scanner scan source -L target/bom.json --config config/osv-scanner.toml --format json --output-file osv.json || true
python3 scripts/gate.py osv.json 9.0
# 4. Slow, nightly only: Dependency-Check against the jars, with the NVD database cached between runs.
- if: github.event_name == 'schedule'
run: >
mvn -B org.owasp:dependency-check-maven:13.0.0:check
-DfailBuildOnCVSS=9 -DsuppressionFiles=config/dc-suppressions.xml
-DnvdApiKeyEnvironmentVariable=NVD_API_KEY
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}