[RRFC] `npm audit fix` should remove optional deps if necessary
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 778
- Forks
- 266
- PR merge metrics
- No merged PRs in 30d
Description
Motivation ("The Why")
Sometimes an optional transitive dependency may have a security advisory against it, and there may be no way to fix it.
For example:
$ npm i express-prometheus-middleware@1.2.0
added 69 packages, and audited 136 packages in 3s
7 packages are looking for funding
run `npm fund` for details
5 vulnerabilities (3 high, 2 critical)
To address all issues, run:
npm audit fix
Run `npm audit` for details.
$ npm audit fix
up to date, audited 136 packages in 565ms
7 packages are looking for funding
run `npm fund` for details
5 vulnerabilities (3 high, 2 critical)
To address all issues, run:
npm audit fix
Run `npm audit` for details.
# oof
# but! check this out!
$ npm i express-prometheus-middleware --omit=optional
added 65 packages, and audited 66 packages in 460ms
7 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Example
How
Current Behaviour
Desired Behavior
References
- n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the npm audit fix command and the optional dependency behavior shown in the issue's express-prometheus-middleware example. Clarify the desired behavior and constraints for removing optional dependencies, then define done as resolving the reported advisories without requiring --omit=optional; no files or tests are named, so implementation entry points still need to be located.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100