vulnlog validate
vulnlog validate checks Vulnlog files against the schema and the validation rules, and prints every finding.
It doesn’t change the files.
Arguments and options
| Name | Value | Default | Description |
|---|---|---|---|
|
One or more Vulnlog files, or |
required |
Files to check. |
|
none |
off |
Treat warnings as errors, so a file with a warning fails. |
For global options and standard input and output, see Global options and Standard input and output.
Findings
Each finding has a level, which decides whether the file fails:
| Level | Result |
|---|---|
|
The file fails. |
|
The file fails only with |
|
The file doesn’t fail. |
A file without errors ends with Validated: <file>.
For the levels and the message format, see Messages.
Files are checked in the order you name them. The command stops at the first file with errors and doesn’t check the files after it.
Every other command that reads a Vulnlog file runs the same checks first and stops on an error.
It prints only the errors, not the warnings and infos.
fmt is the exception: it only needs a file it can parse.
Exit codes
| Code | When |
|---|---|
|
No file has errors, and with |
|
A general error, or stdin is mixed with file names. For the general errors, see Exit codes. |
|
A file can’t be parsed or has errors, or with |
Examples
Check one file:
$ vulnlog validate acme-shop.vl.yaml
info: acme-shop.vl.yaml: releases[4.4.0]: Unreferenced release ID '4.4.0'.
1 info
Validated: acme-shop.vl.yaml
Release 4.4.0 isn’t published yet, and no entry refers to it, so the command prints an info line.
Check a file from stdin:
$ vulnlog validate - < acme-shop.vl.yaml
info: <stdin>: releases[4.4.0]: Unreferenced release ID '4.4.0'.
1 info
Validated: <stdin>
Check a file with an error.
Here, the lodash entry CVE-2021-23337 uses the tag web, which the file doesn’t define:
$ vulnlog validate acme-shop.vl.yaml
info: acme-shop.vl.yaml: releases[4.4.0]: Unreferenced release ID '4.4.0'.
info: acme-shop.vl.yaml: tags[frontend]: Unreferenced tag ID 'frontend'.
error: acme-shop.vl.yaml: vulnerabilities[CVE-2021-23337].tags[web]: References undefined tags 'web'. Defined tags: backend, container, frontend, worker
1 error, 2 infos
hint: ask for help at https://github.com/vulnlog/vulnlog/discussions/categories/q-a
Check a file with --strict, so that a warning fails the file.
Here, the release package URL (PURL) of the 4.3.0 server has no version:
$ vulnlog validate --strict acme-shop.vl.yaml
info: acme-shop.vl.yaml: releases[4.4.0]: Unreferenced release ID '4.4.0'.
warning: acme-shop.vl.yaml: releases[4.3.0].purls[pkg:maven/com.acme/acme-shop-server]: Release purl 'pkg:maven/com.acme/acme-shop-server' has no version, so its VEX statements apply to every version of the artifact.
1 warning, 1 info
hint: ask for help at https://github.com/vulnlog/vulnlog/discussions/categories/q-a
Without --strict, the same file ends with Validated: acme-shop.vl.yaml and exit code 0.