feat: add VEX Hub certifier#3018
Conversation
|
Hi @funnelfiasco or @jeffmendoza, |
mlieberman85
left a comment
There was a problem hiding this comment.
Good scope and the tests aren't trivial, the end-to-end with httptest is the right shape. A few things need to land before this is mergeable.
Blockers (P0):
downloadAndIndexreads the whole archive into memory with no size cap. Tar bomb territory and an OOM as soon as the hub grows past a small set. Two-pass it: parseindex.jsonfirst, then only buffer files referenced by the index. Or set explicit per-entry and total-size limits withio.LimitReader.NewVEXHubCertifierbuilds anhttp.Clientwith noTimeout. If the archive endpoint hangs, the certifier goroutine pins forever. Combined with #1 this is hang-then-OOM.
Should fix before merge (P1):
- PURL matching in
emitVEXDocumentsis direct string lookup, fallback to a hand-rolledstripPurlVersion. Different valid spellings of the same PURL (qualifier order, namespace casing, default vs explicit type, percent-encoding) will silently miss matches. I ran into this recently while working on PURL conformance testing across SBOM generators, where two SBOMs describing the same package routinely produced PURL strings that did not compare equal. Usepackageurl-goto canonicalize both sides before lookup. getArchiveURLwalksmanifest.Versionsand grabs the first one with a location, ignoringspec_version. If Aqua publishes a spec bump and lists it first, this will happily download a manifest format it can't parse. Match against known-compatible spec versions.
Nits:
- Copyright headers on the five new files say 2024.
stripPurlVersionshould not exist.packageurl-goalready parses these.- Test coverage skips: malformed manifest, missing
index.json, oversized archive, network errors, multi-version manifest, stripped-version-still-misses.
What I like: configurable manifest URL, rate limiter wired up, pkg:guac/* skip, dedupe via seen, the // subdir hack from the VEX Repo Spec parsed correctly in getArchiveURL.
Happy to look again once 1 and 2 are addressed.
|
Hi @mlieberman85, |
|
This pull request has been automatically marked as stale because it has not had recent activity (60 days of inactivity). |
Signed-off-by: Abhishek <abhishekup082@gmail.com>
Signed-off-by: Abhishek <abhishekup082@gmail.com>
Description of the PR
This PR adds a new certifier to support VEX Hub integration, as discussed in the linked issue.
The
vexhubcertifier queries repositories conforming to the VEX Repo Spec. It fetches the manifest (vex-repository.json), downloads the tar.gz archive, and usesindex.jsonto map package PURLs to their corresponding OpenVEX documents. The manifest URL is configurable via the--vexhub-manifest-urlflag (defaults to the Aqua Security VEX Hub).Both
guaconeandguaccollectCLI commands have been added.Fixes #2296
PR Checklist
-sflag togit commit.