Choose when the build fails
witnyx check reads a software bill of materials (SBOM) and exits with code 1 when one of its failure rules triggers, so your pipeline can stop the release.
You choose the rules with --fail-on on the command line or with failOn in .witnyx.yml.
Without either, the only rule is exploited: the build fails on actively exploited vulnerabilities and on nothing else.
The rules
Section titled “The rules”| Rule | The build fails when the check finds |
|---|---|
exploited |
An actively exploited vulnerability in a component: one that CISA’s Known Exploited Vulnerabilities catalogue lists. This is the default. |
critical |
A known vulnerability rated critical. Actively exploited vulnerabilities are always rated critical, so they count too. |
high |
A known vulnerability rated high or critical, actively exploited ones included. |
eol |
A component past its end of life. A component that reaches its end of life within 90 days is reported, but it does not fail the build. |
quality:<min %> |
An SBOM that fails the EU legal minimum, or whose completeness score is below the minimum, a whole number from 0 to 100, such as quality:80. See SBOM quality. |
none |
Nothing. The report still lists every finding. |
- The rules ignore letter case, and
quality:80%is read asquality:80. - One
quality:<min %>rule at most;nonecannot be combined with another rule. - A vulnerability that a person assessed as not affected does not count for any rule. One that is pending human review still counts.
Set the rules
Section titled “Set the rules”On the command line, separate the rules with commas.
The build fails when any of them triggers. When exploited did not trigger, the report’s headline names the rules that did:
$ witnyx check bom.json --fail-on exploited,eolWitnyx release security check — legacy-app 1.0.0
[FAIL] Build failed: --fail-on eol
[FAIL] 1 component past end of life Spring Framework 6.0 reached end of life on 2024-06-30 -> upgrade to 7.0.10 (org.springframework:spring-core 6.0.23)In the JSON report, result.failOn lists the rules of the run and result.triggeredBy the ones that triggered.
In .witnyx.yml, write the rules as a list:
version: 1failOn: [exploited, eol]--fail-on wins over failOn. The two are not merged: with the flag, the file’s rules are not used.
An empty --fail-on value, such as an unset variable in CI, counts as not given, so the file’s rules, or the default, apply.
Report without failing the build
Section titled “Report without failing the build”The default rule stops the build on an actively exploited vulnerability:
$ witnyx check bom.json[FAIL] 1 actively exploited vulnerability — build failed CVE-2021-44228 org.apache.logging.log4j:log4j-core 2.14.1 -> upgrade to 2.15.0 (on CISA's exploited list since 2021-12-10; used in ransomware; also listed by ENISA as EUVD-2021-34768)With --fail-on none, the same finding is a warning and the exit code is 0:
$ witnyx check bom.json --fail-on none[WARN] 1 actively exploited vulnerability CVE-2021-44228 org.apache.logging.log4j:log4j-core 2.14.1 -> upgrade to 2.15.0 (on CISA's exploited list since 2021-12-10; used in ransomware; also listed by ENISA as EUVD-2021-34768)Use none to see the report while you introduce the check, and choose the rules before you rely on it to stop a release.
When a check is incomplete
Section titled “When a check is incomplete”A check is incomplete when a required data source gave no answer: OSV, which lists the known vulnerabilities of each package, or CISA’s Known Exploited Vulnerabilities catalogue.
No component then counts as checked. The text report’s headline says [INCOMPLETE] and names the source, and in the JSON report result.complete is false.
An incomplete check is not a pass: it says nothing about the vulnerabilities it could not look up. How a check works explains the data sources.
- Without
--strict, an incomplete check exits with code 0 when no rule triggered, and with code 1 when one did. - With
--strict, an incomplete check exits with code 2, unless a rule triggered: that still gives exit code 1. The report is written in full, withexitCode2 in the JSON report; it is not the error document.
Add --strict in CI when an outage of a data source must stop the release instead of passing unnoticed.
The optional sources, ENISA’s exploited list, endoflife.date and a security.txt URL, never make a check incomplete; when one fails, the report adds a note.
An offline check is always incomplete, because OSV has no offline copy, so --offline --strict never exits with code 0. Work offline shows that run.
What the exit code means
Section titled “What the exit code means”| Code | Meaning |
|---|---|
| 0 | The check ran and no rule triggered. Without --strict, the check may be incomplete: read the report. |
| 1 | The check ran and a rule triggered. The tool did not fail. |
| 2 | The check could not run, for example because of a wrong rule or an SBOM that cannot be read, or it was incomplete and --strict was given. |
Exit codes covers every command.
See also: Your first check for reading a report, and the CI recipes for GitHub Actions, GitLab CI, Jenkins and Docker.
What can go wrong
Section titled “What can go wrong”A misspelt rule stops the check before anything is downloaded:
$ witnyx check bom.json --fail-on exploitderror WX-CONFIG: Unknown value 'exploitd' in --fail-on.hint: Supported values: exploited, critical, high, eol, quality:<min %>, none.The other mistakes stop it the same way, with the error code WX-CONFIG and exit code 2:
| The message says | What to do |
|---|---|
'none' cannot be combined with other values |
Use none alone, or a list of rules. |
needs a minimum score |
Give the minimum: quality:80, not quality. |
accepts only one quality:<min %> value |
Keep the one minimum you need. |
Unknown value 'exploited,eol' in failOn |
In .witnyx.yml, write a list: failOn: [exploited, eol]. |
If the build passes although the report shows an actively exploited vulnerability, read the report’s rules: result.failOn in the JSON report.
A rule list without exploited, critical or high, such as eol alone or none, lets that vulnerability pass as a warning.
Witnyx is a record-keeping and workflow tool. It does not certify compliance. Nothing on this site is legal advice.