Skip to content

fix(npm-audit-autofix): always run audit fix without --omit=dev#69

Merged
tehw0lf merged 2 commits into
mainfrom
fix/npm-audit-fix-omit-dev
Apr 23, 2026
Merged

fix(npm-audit-autofix): always run audit fix without --omit=dev#69
tehw0lf merged 2 commits into
mainfrom
fix/npm-audit-fix-omit-dev

Conversation

@tehw0lf
Copy link
Copy Markdown
Owner

@tehw0lf tehw0lf commented Apr 23, 2026

Summary

  • npm audit fix now always runs without --omit=dev, regardless of the omit_dev input
  • The --omit=dev flag on npm audit fix caused node_modules to lose 900+ packages while leaving package-lock.json unchanged → git diff --quiet saw no changes even though a fix was needed
  • The omit_dev input still applies to the read-only npm audit check in the verify step (intended behavior)

Root cause

npm audit fix --omit=dev treats --omit=dev as an install-time filter: it removes dev dependencies from node_modules in memory but does not rewrite package-lock.json. So after the fix, git diff package-lock.json is always empty, and the workflow concludes "no changes" even when vulnerabilities were fixed.

Running npm audit fix (without --omit=dev) correctly rewrites package-lock.json so the diff is detectable.

Test plan

  • Trigger the autofix workflow on a Dependabot PR in a repo with known audit findings
  • Verify git diff package-lock.json now shows changes after fix
  • Verify npm audit --omit=dev still uses the flag in the verify step

tehw0lf added 2 commits April 23, 2026 19:12
Running npm audit fix --omit=dev removes all dev dependencies from node_modules
without writing them back to package-lock.json, causing git diff to see no changes
even when 920+ packages were removed. The audit step still respects omit_dev for
read-only audit checks.
@tehw0lf tehw0lf enabled auto-merge (squash) April 23, 2026 17:28
@tehw0lf tehw0lf merged commit 3068f73 into main Apr 23, 2026
2 checks passed
@tehw0lf tehw0lf deleted the fix/npm-audit-fix-omit-dev branch April 23, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant