snyk-filtertool provides custom filtering for Snyk CLI output.
snyk-filtertakes the JSON-formatted output from the Snyk CLI, for example,
snyk test --jsonand applies custom filtering of the results, as well as options to fail your build.
npm install -g
node-jqlibrary, which requires that a
jqbinary be installed. This typically happens transparently via
npm install -g, but on some systems
jqis not properly installed locally. If you receive an error after installation regarding
node-jq, then install
jqmanually to avoid this error.
snyk test --jsonoutput into
snyk-filteror use the
-iargument to input a JSON file. Use the
-fargument to point to the yml file containing your custom filters if you are not using the default location (.snyk-filter/snyk.yml).
snyk-filteris 0 for pass (no issues) and 1 for fail (issues found).
snyk test --json | snyk-filter
snyk test --json | snyk-filter -f /path/to/example-cvss-9-or-above.yml
snyk-filter -i snyk_results.json
snyk-filter -i snyk_results.json -f /path/to/example-high-upgradeable-vulns.yml
--jsonto output JSON