Skip to content

npm audit --only=prod is not ignoring dev dependency vulnerabilities #440

@mportela

Description

@mportela

In our huskyCI/api/config.yaml file the npm audit try to only analyse the prod dependency using the command:

npm audit --only=prod --json > /tmp/results.json 2> /tmp/errorNpmaudit

but this command stay reporting vulnerability from dev dependencies 😭 ...

reference: npm/cli#125

to solve this issue while they don`t have this fixed we could use an intermediate help script that parse the audit json result and generate a final result without the dev dependencies...

npm audit --json >> /tmp/audit_report.json
npm run audit:process

like this:
https://medium.com/@linzhao/npm-audit-with-travis-ci-d7acc3e2195a

** to reproduce the npm audit problem ignoring the only=prod :

mkdir test_audit
cd test_audit
npm init
npm i -D [email protected]
npm audit --only=prod

this will print dev dependencies vulnerabilities...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions