Skip to content

Fix npm dependency vulnerabilities (Webpack 3 compatible) #421

@polevaultweb

Description

@polevaultweb

Summary

GitHub Dependabot flagged 30 open vulnerability alerts (2 Composer dev-only, 28 npm). The npm runtime dependencies that ship in dist/ need updating, but the current build toolchain (Webpack 3 + Babel 6) cannot parse modern ES module syntax.

Key Constraint

Webpack 3 + Babel 6 only supports CommonJS/ES5. Any updated dependency must not use ES module syntax (export default, object spread in source, optional chaining, etc.) or the build will fail.

Runtime deps to update (ship in dist/)

Package Current Issue Notes
axios ^0.18.0 SSRF, ReDoS CVEs 1.x uses ESM — need highest safe 0.x (likely 0.21.4 or 0.28.x)
sanitize-html ^1.18.2 Multiple CVEs 2.x uses ESM — need highest safe 1.x or find CJS-compatible 2.x
qs ^6.5.1 Prototype pollution Likely safe to update within 6.x (stays CJS) — verify

What was tried

  • Updated to axios@^1.7.0, qs@^6.14.0, sanitize-html@^2.13.0
  • npm install required --legacy-peer-deps (eslint peer conflict) and --ignore-scripts (node-sass needs native build)
  • npm run build failed: Webpack 3 cannot parse ES module syntax in axios 1.x and sanitize-html 2.x

Approach

  1. Find the highest versions of each package that are both CVE-free AND Webpack 3 compatible
  2. If no safe+compatible version exists, consider vendoring a pre-built bundle or pinning with an overrides entry
  3. Long term: modernise the build toolchain (Webpack 5 + Babel 7 or Vite) — tracked separately as Vue 2→3 migration

Dev-only deps (lower priority)

The 26 remaining npm alerts are in devDependencies (grunt, webpack-dev-server, node-sass, etc.) that never ship to customers. These are noise unless the build toolchain is modernised.

2 Composer alerts (phpunit, symfony/process) are also dev-only.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions