Skip to content

relgap audit ​

Scans each root for repositories the way 'relgap drift' does and asks OSV about the version of every pin: one query per tool, version and OSV package, however many repositories pin it. --tool limits the run to the named tools. Ignore rules in the config drop matching pins.

An exact pin is checked at its own version and needs no lookup for it. A value marked ≈ is checked at the version it stands for, the CURRENT of 'relgap outdated': a constraint (~> 1.15) takes the highest exact pin of the tool in the same repository that satisfies it, otherwise the lowest version that does; a prefix (26) takes the highest stable version that starts with it; the latest channel takes the latest version. To find the version, only these pins need the tool's versions from GitHub or another host.

A pin with a curated osv list in its registry entry queries those packages. Other pins query the package their backend names (npm:, pypi:, cargo:, gem:, go:, dotnet:), or the Go module and git repository of a github.com tool. An action pin (scan.detectors.ci_actions) queries the GitHub Actions package of its repository once without a version, because OSV doesn't match those ranges to a version, and relgap matches them itself. A pin by commit SHA is checked at the version its line comment names (# v4.1.3), as Renovate reads it; without one it is not-exact. A finding is one advisory that affects one tool version, with every pin of that version, its severity, the lowest fixed version and its osv.dev page. A record without a rating takes the rating of its GHSA alias, else its severity is unknown. Findings sort by severity, unknown last, then by ID; with --kev and --epss, findings in the KEV catalog come first and the EPSS score breaks ties of severity.

Each finding has a fix target, listed under "Fix targets" and as fix in --format json: the lowest stable release above the version that every advisory with a fix has left behind, and the same within the version's line. Candidates are checked against the advisories' ranges, then OSV is asked about them and the latest release; a candidate with an advisory of its own moves the target on. An advisory the latest release still has is one no release fixes (fix is null), and relgap warns when the latest release has any. Only a tool version with findings lists its tool's versions for this.

A pin OSV wasn't asked about is listed with the reason, and never counts as clean: no-advisory-source, private-source, not-exact, unresolved, offline or failed.

Config vulns.ignore suppresses an advisory by its ID or any alias, with a required reason, an optional until date and optional tools globs (kubectl, npm:*, action:actions/*). --vex (config vulns.vex) reads OpenVEX v0.2.0 documents: the latest statement about an advisory whose product or subcomponent purl names the pin suppresses it when it says not_affected or fixed. A suppressed advisory is listed under "Suppressed" with its reason (suppressed in --format json), doesn't count for --fail-on and doesn't hold back the fix target. relgap warns about an entry past its until date, which suppresses nothing, and, without --tool, about an entry that suppressed nothing.

--kev (config vulns.kev) marks the findings whose CVE is in the CISA Known Exploited Vulnerabilities catalog, which relgap fetches from www.cisa.gov once a day, with the date CISA added it and whether it knows of ransomware use: a KEV column, and kev in --format json and SARIF. --epss (config vulns.epss) adds each finding's FIRST EPSS score, the probability of exploitation in the next 30 days, from api.first.org: an EPSS column with the percentile, and epss in --format json and SARIF. Both are off by default. When a feed is down, relgap warns, --format json lists the error, and the report goes on without that field.

--format openvex writes an OpenVEX v0.2.0 document: one statement per advisory and tool version, affected with the fix target as the action statement, and not_affected (or the VEX status that suppressed it) with the reason. Products are the purls of the advisories' packages, such as pkg:golang/stdlib@v1.22.0, pkg:npm/lodash@4.17.20 or pkg:githubactions/actions/checkout@v4.1.2.

--format sarif writes a SARIF 2.1.0 log for GitHub code scanning: a result per finding at each pin's file and line (one rule per OSV ID), a note per unchecked pin (unchecked), and a result per file or version lookup that failed (failed). The results don't depend on --fail-on.

--fail-on takes vuln, unchecked and kev. vuln counts the findings at or above --vuln-severity and those of unknown severity, and with --vuln-fixable only those with a fixed version above the pinned one. unchecked counts the unchecked tool versions. kev counts the findings in the KEV catalog, whatever their severity, and needs --kev. audit gates vuln by default. Values in config policy.fail_on that audit checks add to vuln, and --fail-on replaces the whole set: --fail-on unchecked gates only unchecked, and --fail-on= gates nothing. A value whose count reaches --min-count (default 1) exits 3. Otherwise a file or lookup that failed exits 1, and so does an OSV outage under --fail-on vuln or a KEV outage under --fail-on kev, since a pass on partial data proves nothing.

--offline answers from the HTTP cache. Pins without a cached answer are unchecked with reason offline, and --format json has oldest_answer, when the oldest OSV answer was stored.

Roots default to scan.roots, then the current directory.

Usage ​

sh
relgap audit [roots...] [flags]

Arguments ​

ArgumentRequiredRepeatable
rootsnoyes

Flags ​

FlagDescriptionTypeDefaultValuesConfig keyNotes
--epssadd each advisory's FIRST EPSS score, asking api.first.org about its CVE IDs (config vulns.epss)boolvulns.epss
--fail-onexit 3 when this matches: vuln, unchecked or kev; repeatable; replaces the default vuln, which config policy.fail_on adds tolist, repeatablevuln: a known vulnerability in a pinned version
unchecked: a pinned version OSV wasn't asked about
kev: a known vulnerability in the CISA KEV catalog; needs --kev
policy.fail_on
--kevmark advisories in the CISA Known Exploited Vulnerabilities catalog, fetched from www.cisa.gov (config vulns.kev)boolvulns.kev
--md-max-charscut Markdown output to this many characters at a row or section boundary; 0 means no limitint60000
--min-countfindings a --fail-on value needs before it exits 3int1
--outalso write the report to a file as format=path (repeatable); format is one of plain, md, json, sarif, github or openvexstring, repeatableplain: table without color
md: Markdown
json: JSON envelope for scripts
sarif: SARIF 2.1.0 for code scanning
github: GitHub Actions annotations
openvex: OpenVEX v0.2.0 document
--submodulesscan checked-out git submodules as repositoriesbool
--toolaudit only this tool; repeatablelist, repeatable
--vexOpenVEX v0.2.0 document whose not_affected and fixed statements suppress advisories; repeatable; replaces config vulns.vexlist, repeatablevulns.vex
--vuln-fixable--fail-on vuln counts only advisories with a fixed version above the pinned one (config policy.vuln_fixable)boolpolicy.vuln_fixable
--vuln-severitylowest rating --fail-on vuln counts: low, medium, high or critical; an unknown rating always counts, and empty counts all (config policy.vuln_severity)stringlow: CVSS 0.1 to 3.9
medium: CVSS 4.0 to 6.9
high: CVSS 7.0 to 8.9
critical: CVSS 9.0 to 10.0
policy.vuln_severity

The global flags work with every command.

Output formats ​

--format accepts tty, plain, md, json, sarif, github, openvex. Without it, the format is tty when stdout is a terminal and plain otherwise. Formats are described on the global flags page.

Fail-on values ​

--fail-on makes the command exit 3 when the report has a match:

ValueMatches
vulna known vulnerability in a pinned version
uncheckeda pinned version OSV wasn't asked about
keva known vulnerability in the CISA KEV catalog; needs --kev

Exit codes ​

CodeMeaning
0The command finished. With --fail-on, nothing matched.
1The command failed: a read, a write, a child process or a check failed.
2Wrong usage: an unknown command or flag, a bad value or argument, an invalid config file, or a prompt with no terminal.
3A --fail-on gate matched. The report is still written.
4Credentials were missing or rejected for every source the command needed.
130Interrupted by Ctrl-C (SIGINT) or a cancelled context.

All codes are listed on the exit codes page.

Examples ​

sh
relgap audit
relgap audit ~/src/infra ~/src/apps --format md
relgap audit --tool terraform --tool node
relgap audit --vuln-severity high --format sarif > audit.sarif
relgap audit --fail-on vuln --fail-on unchecked
relgap audit --vuln-fixable --vuln-severity high
relgap audit --kev --epss --fail-on kev
relgap audit --vex vex/platform.json --format openvex > audit.vex.json
relgap audit --format json | jq '.data.findings[] | {tool, version, id}'