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 clone the repo and run the script locally using:
npm install npm run build node ./dist/index.js
|Template location for generating the html. Defaults to template/test-report.hbs|
|Input path from where to read the json. Defaults to stdin|
|Output of the resulting HTML. Example: -o snyk.html. Defaults to stdout|
|Generates an HTML with only the summary, instead of the details report. Defaults to details vulnerability report|
|Runs the CLI in debug mode|
|Display actionable remediation info if available|
When in doubt, use
snyk-to-html --help or
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
snyk test --json | snyk-to-html -o results.html
Using a temporary file:
Generate JSON data by running
snyk test and save the output to a file
snyk test --json > results.json
Pass the resulting JSON file to Snyk's JSON to HTML Mapper
snyk-to-html -i results.json -o results.html
Note input files should be valid JSON and use UTF-8 encoding.
If you want a simpler version of the report to be shown, you can pass
--summary to only
display the summary of the report.
snyk-to-html -i results.json -o results.html -s
Show actionable remediation:
To display the actions you can take to remedy vulnerabilities, pass
snyk-to-html -i results.json -o results.html -a
The report orders remediations (upgrades and patches) by the number and severity of vulnerabilities it fixes. Use this to guide when selecting the order to upgrade and patch packages.
Note we currently support remediation advice with the following package managers:
Simply open your new file (
results.html above) in a browser, and rejoice.