Verifying npm Audit Fix Results

Compare package.json before and after running npm audit fix to verify that vulnerability patches were applied correctly without unexpected changes.

Security

Detailed Explanation

Validating npm audit fix Results

Running npm audit fix can modify your package.json automatically. The Package.json Diff tool helps you verify exactly what changed, ensuring no unexpected modifications were made.

Before vs. after npm audit fix

dependencies:
  ~ semver: 7.5.3 -> 7.5.4                 [PATCH]
  ~ word-wrap: 1.2.3 -> 1.2.5              [PATCH]
    react: ^18.2.0                          [UNCHANGED]
    next: ^14.0.0                           [UNCHANGED]

devDependencies:
  ~ postcss: 8.4.27 -> 8.4.31              [PATCH]
  ~ webpack: 5.88.0 -> 5.88.2              [PATCH]

What to verify

  1. Only patch bumps: Security fixes should be patch-level. Major/minor bumps are suspicious
  2. Expected packages: Cross-reference with npm audit output
  3. No removals: audit fix should not remove packages
  4. No additions: Unless a transitive dependency needs a direct entry
  5. No downgrades: Downgrades could reintroduce vulnerabilities

npm audit fix --force concerns

The --force flag allows major version bumps. Always compare the result:

dependencies:
  ~ nth-check: 1.0.2 -> 2.1.1              [MAJOR] ⚠️
  ~ glob-parent: 5.1.2 -> 6.0.2            [MAJOR] ⚠️

Major bumps from audit fix --force require careful testing -- they may introduce breaking changes.

Workflow

  1. Save current package.json (paste into left panel)
  2. Run npm audit fix
  3. Paste updated package.json into right panel
  4. Compare and verify only expected changes were made
  5. Run tests to confirm nothing broke
  6. Copy results for audit documentation

Use Case

A compliance team requires documentation of security remediation steps. After running npm audit fix, the developer uses Package.json Diff to generate a before-and-after comparison report showing exactly which packages were patched.

Try It — Package.json Diff

Open full tool