Skip to content

ci: check every pull request for dependencies with known CVEs - #1488

Draft
joaodinissf wants to merge 2 commits into
masterfrom
feat/cve-fast-scan
Draft

ci: check every pull request for dependencies with known CVEs#1488
joaodinissf wants to merge 2 commits into
masterfrom
feat/cve-fast-scan

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

What

Adds a fast, blocking cve-scan PR lane that reports dependencies with known vulnerabilities in ~1–2 minutes, instead of these surfacing at release time.

How it works:

  1. cyclonedx-maven-plugin + tycho-sbom generate an aggregate CycloneDX SBOM of the full reactor including the resolved target platform — tycho-sbom maps p2 bundles back to their original Maven coordinates (146 pkg:maven purls today), which is the surface Dependabot and GAV-based tooling cannot see.
  2. .github/scripts/check-cves.sh extracts the purls and queries the OSV.dev batch API (one POST, ~2s, no API key; 99.9% availability SLO).
  3. Advisories that demonstrably do not affect shipped artifacts live in .github/security/cve-ignores.json, each with a justification and review date.

Fail-loud design — a broken scan can never pass silently:

  • a canary purl with well-known advisories is appended to every batch and must come back flagged,
  • a minimum-purl floor catches SBOM regressions (e.g. the target platform silently dropping out),
  • network/API errors abort with a non-zero exit.

Current ledger (the four findings present today):

  • 3 × Jetty 12.1.9 advisories — pulled only via the com.avaloq.tools.ddk.xtext.test bundle, not part of the shipped update site,
  • assertj-core 3.24.2 XXE in isXmlEqualTo (local vector) — this one is shipped; accepted with a review date until the target platform picks up a fixed version.

Notes

  • The pom change is pluginManagement-only (no lifecycle binding): the default build is byte-for-byte unaffected; verified with a full reactor compile.
  • The workflow mirrors the existing verify lanes: pinned actions, restore-only Maven cache keyed to the snapshot producer, WORKSPACE env. It runs as a fifth parallel lane, adding zero wall-clock to PR feedback; it also introduces the repo's first timeout-minutes.
  • osv-scanner was evaluated and deliberately not used: its CycloneDX ingestion (2.5.0) drops Maven groupIds (silent false negatives) and its offline mode reports zero findings without error. The OSV API is queried directly instead.
  • Developers can run the same check locally: bash .github/scripts/check-cves.sh (documented in CONTRIBUTING.md).
  • The 314 pkg:p2-only components (Eclipse-native bundles with no Maven identity) are recorded in the scan artifacts as the documented coverage gap; a follow-up PR will add a scheduled OWASP dependency-check lane to cover them via NVD/CPE matching.

Verification

  • Full pipeline green locally: 146 purls scanned, canary trips, ignores apply (39s cold, 0.6s with --skip-sbom).
  • Negative tests: unflaggable canary → exit 2; purl floor → exit 2; emptied ledger → exit 1 listing exactly the four findings above.
  • mvn clean compile of the full reactor unaffected by the pom change.

🤖 Generated with Claude Code

joaodinissf and others added 2 commits August 12, 2026 00:47
Add cyclonedx-maven-plugin with the tycho-sbom extension to pluginManagement
so an aggregate SBOM of the full reactor, including the resolved target
platform, can be generated on demand:

  mvn -f ddk-parent/pom.xml validate \
    org.apache.maven.plugins:maven-dependency-plugin:3.8.1:resolve \
    org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeBom \
    org.cyclonedx:cyclonedx-maven-plugin:2.9.1:makeAggregateBom

tycho-sbom maps p2 artifacts to their original Maven coordinates using the
GAV properties Tycho records when mirroring bundles, so third-party
dependencies appear as real pkg:maven purls (146 today) rather than
synthetic p2 identifiers. Notes baked into the configuration:

- skipNotDeployed=false is required because the reactor sets
  maven.deploy.skip=true globally, which otherwise makes the goal skip
  every module,
- tycho.sbom.url must be a project property (tycho-sbom reads project
  properties, not -D user properties),
- dependency:resolve must precede the BOM goals: Tycho only injects p2
  dependencies into the Maven model under full dependency resolution.

No execution is bound to any lifecycle phase; the default build is
unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add a fast, blocking cve-scan workflow so vulnerable dependencies surface
in minutes on the PR instead of at release time. The check generates the
aggregate CycloneDX SBOM (full reactor plus resolved target platform) and
queries the OSV.dev batch API with the resulting pkg:maven purls - a
single POST, measured ~2s for 146 components, no API key required.
Advisories that demonstrably do not affect shipped artifacts are recorded
in .github/security/cve-ignores.json, each with a justification and a
review date; the ledger starts with the four current findings (Jetty via
the xtext.test bundle only, and the assertj XXE advisory, which does ship
and is accepted until the target platform picks up a fixed version).

The scan is designed to fail loudly rather than pass silently:

- a canary purl with well-known advisories is appended to every batch and
  must come back flagged, otherwise the run aborts,
- a minimum-purl floor aborts the run if the SBOM regresses to a shell
  without the target platform,
- OSV API or network errors abort the run.

osv-scanner is deliberately not used: its CycloneDX ingestion (2.5.0)
drops Maven groupIds, turning every query into a silent miss, and its
offline mode reports zero findings without error.

The same check runs locally via bash .github/scripts/check-cves.sh (see
the new CONTRIBUTING section). The workflow follows the existing verify
lanes: restore-only Maven cache keyed to the snapshot producer, pinned
actions, and an explicit job timeout.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant