Skip to content

Instantly share code, notes, and snippets.

@cromwellryan
Created June 7, 2022 16:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cromwellryan/eceadda350e9945ca39052df50fe7b2c to your computer and use it in GitHub Desktop.
Save cromwellryan/eceadda350e9945ca39052df50fe7b2c to your computer and use it in GitHub Desktop.
# Generate an audit report of High & Critical advisories
yarn audit --json --level high > audit.lines
# Transform from JSON-lines to JSON format
jq -s '.' audit.lines > audit.json
# Extract advisories
jq -r '.[] |
select(.type == "auditAdvisory") |
{ severity: .data.advisory.severity, path: .data.resolution.path, cves: (.data.advisory.cves | @csv), module_name: .data.advisory.module_name } |
select(.severity == "critical" or .severity == "high") |
[.severity, .module_name, .path, .cves] |
@csv' \
audit.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment