The Snyk JSON to HTML Mapper takes the json outputted from snyk test --json and creates a local HTML file displaying the vulnerabilities discovered.
First, Install the Snyk JSON to HTML Mapper using npm:
npm install snyk-to-html -g
Alternatively, you can skip this step, clone the repo and run the script locally (using node ./snyk-to-html.js)
-tor--template- Template location for generating the html. Defaults to template/test-report.hbs-ior--input- Input path from where to read the json. Defaults to stdin-oor--output- Output of the resulting HTML. Example: -o snyk.html. Defaults to stdout-sor--summary- Generates an HTML with only the summary, instead of the details report. Defaults to details vulnerability report
When in doubt, use snyk-to-html --help or snyk-to-html -h.
Change directory to your package's root folder, then use of the two ways below to generate the HTML report.
-
Directly streaming the results to snyk-to-html:
Run the following line to create a file called
results.html:snyk test --json | snyk-to-html -o results.html -
Using a temporary file:
Generate JSON data by running
snyk testand save the output to a filesnyk test --json > results.jsonPass the resulting JSON file to Snyk's JSON to HTML Mapper
snyk-to-html -i results.json -o results.html -
By default, details about each vulnerability is shown.
If you want a simpler version of the report to be shown, you can pass
-sor--summaryto only display the summary of the report.snyk-to-html -i results.json -o results.html -s
Simply open your new file (results.html above) in a browser, and rejoice.