A VEX workflow for Grype and OSV-Scanner
By the CapyShield team · · 5 min read
In short
Grype reads OpenVEX directly: pass the file with --vex or list it under vex-documents in .grype.yaml, and findings marked not_affected or fixed move to the ignored list. OSV-Scanner's documented configuration has no VEX input, so not_affected statements are translated into [[IgnoredVulns]] entries in osv-scanner.toml. capyshield vex produces the same OpenVEX from either scanner's JSON report, so one reviewed decision applies to both.
VEX workflows are usually explained with Trivy, but Grype and OSV-Scanner reports need the same triage. The workflow is the same up to the last step: scan to JSON, decide reachability, write OpenVEX. Grype then reads the OpenVEX file directly with --vex. OSV-Scanner's documented configuration has no VEX input, so the decisions go into its osv-scanner.toml instead. This post covers both.
Can you use VEX with Grype and OSV-Scanner?
- Grype: yes. It accepts OpenVEX and CSAF VEX documents via
--vexor thevex-documentslist in.grype.yaml, and filters findings the document marksnot_affectedorfixed. - OSV-Scanner: not as a VEX file. It suppresses findings through
[[IgnoredVulns]]entries inosv-scanner.toml, each with an optional reason and expiry date. A VEX document is still the right place to record the decision; you translate itsnot_affectedstatements into ignore entries.
On the producing side, capyshield vex reads Grype's -o json and OSV-Scanner's --format json output as well as Trivy's, auto-detects which one it was given, and writes the same OpenVEX v0.2.0 either way.
How do you generate OpenVEX from a Grype report?
Scan the repository directory to JSON, then triage it:
grype dir:. -o json > grype.json
capyshield vex --scanner grype --input grype.json --repo . \
--output release.openvex.json --summary vex.md --fail-on high,criticalFor Node.js and Python packages, each finding is checked against your lockfiles and production imports. A dev-only package, or a direct dependency no production file imports, becomes not_affected with the justification vulnerable_code_not_in_execute_path. A package imported in production becomes affected, with an upgrade action_statement. Anything else, including transitive packages that production code doesn't import directly and other ecosystems, is under_investigation. --fail-on high,critical exits with code 3 only when an affected finding has one of those severities.
How does Grype apply an OpenVEX document?
Pass it on the next scan, or list it in the config file so every scan uses it:
grype dir:. --vex release.openvex.json
# .grype.yaml
vex-documents:
- release.openvex.jsonThe Grype docs describe the behaviour:
- Filtering statuses. Findings marked
not_affectedorfixedare moved to the ignored list automatically. - Augmenting statuses.
affectedandunder_investigationstatements only add results when you opt in withvex-add: ["affected", "under_investigation"]. - Nothing disappears silently. In table output,
--show-suppressedshows filtered findings labelled as suppressed by VEX. In JSON output they move to theignoredMatchesarray, with the VEX rule inappliedIgnoreRules. - Gates run after filtering. Grype converts VEX documents into ignore rules before its
--fail-onseverity check, sogrype dir:. --vex release.openvex.json --fail-on highfails only on findings the VEX doesn't rule out.
One version note. capyshield vex names each vulnerable package's own purl as the product, for example pkg:npm/[email protected]. Older Grype releases matched OpenVEX products only against identifiers of the scan target, such as the image, with packages listed as subcomponents. Grype pull request #3168, released in v0.108.0, added a fallback that matches the package's own identifiers as the product. If --show-suppressed shows nothing suppressed, check your Grype version first.
How do you triage OSV-Scanner results?
The same way, starting from OSV-Scanner's JSON output:
osv-scanner scan source --format json -r . > osv.json
capyshield vex --scanner osv --input osv.json --repo . --output release.openvex.jsonOSV-Scanner has its own reachability feature that complements this one. With call analysis, which is on by default for Go and experimental for Rust, it marks vulnerabilities whose vulnerable functions are never called as unexecuted. CapyShield's analysis covers Node.js and Python at the package level: whether production code imports the package at all. Between them, a polyglot repository gets a first-pass answer for more of its findings than either tool gives alone.
The two signals also fail in different ways, which is useful. Call analysis can only judge code it can build and resolve, and it says nothing about packages in languages it doesn't cover. Import analysis can't tell which function of an imported package you call, so a package imported for one harmless helper still counts as affected. When a finding stays affected or under_investigation after both, that is the short list worth a person's time: read the advisory, find the vulnerable function, and check whether your code calls it with input an attacker controls.
How do you turn OpenVEX into osv-scanner.toml ignores?
Translate the not_affected statements into [[IgnoredVulns]] entries, carrying the justification and package into the reason field so the file explains itself:
jq -r '.statements[] | select(.status == "not_affected") |
"[[IgnoredVulns]]\nid = \"\(.vulnerability.name)\"\nreason = \"\(.justification // "not_affected"): \(.products[0]["@id"])\"\n"' \
release.openvex.json > osv-scanner.tomlOn CapyShield's sample OpenVEX output, that produces:
[[IgnoredVulns]]
id = "CVE-2020-15168"
reason = "vulnerable_code_not_in_execute_path: pkg:npm/[email protected]"
[[IgnoredVulns]]
id = "CVE-2022-0235"
reason = "vulnerable_code_not_in_execute_path: pkg:npm/[email protected]"Know what you give up in the translation, all of it from OSV-Scanner's configuration docs:
- Ignores are by vulnerability ID, not by package. A VEX statement says a CVE doesn't affect one package version. An
IgnoredVulnsentry hides that ID wherever it appears in the files the config applies to, and also hides its aliases, so a CVE entry covers the matching GHSA advisory. - Config is per directory. An
osv-scanner.tomlapplies only to the lockfiles in its own directory, not to child directories. For a monorepo, pass one file to every scan with--config. - Add an expiry.
effectiveUntilmakes an ignore lapse on a date, which forces a re-check instead of a permanent exception.
Keep the OpenVEX file as the record of truth, ship it with the release for anyone running Trivy, Grype or vexctl, and regenerate the TOML from it on each build rather than editing both by hand.
Where do manual decisions go?
In .capyshield/vex-rules.yaml, next to the code. Local rules are applied before reachability, match by package name or purl, and flow into the OpenVEX output, so they reach Grype through --vex and OSV-Scanner through the generated TOML without a second edit. That is the point of the workflow: whichever scanner your team or your customers run, one reviewed decision applies everywhere. The CLI is open source, and the docs cover running it in CI.
Frequently asked questions
- Does Grype support VEX?
- Yes. Grype accepts OpenVEX and CSAF VEX documents with --vex or the vex-documents config key, and moves findings marked not_affected or fixed to its ignored list. --show-suppressed displays them in table output, and JSON output lists them under ignoredMatches.
- Does OSV-Scanner read OpenVEX files?
- Its documented configuration has no VEX input. Findings are suppressed with [[IgnoredVulns]] entries in osv-scanner.toml, which take an ID, an optional reason and an optional effectiveUntil expiry date.
- Why doesn't Grype suppress findings from a package-level OpenVEX file?
- Older Grype releases matched OpenVEX products only against the scan target's identifiers, such as the image. Grype v0.108.0 added matching against a package's own purl as the product, so upgrade if package-level statements are not applied.
- Can capyshield vex read Grype and OSV-Scanner reports?
- Yes. It reads grype -o json and osv-scanner --format json output as well as Trivy JSON, auto-detects the scanner, and writes OpenVEX v0.2.0 either way.