Skip to content

Update dependencies to address vulnerabilities #11

@protobi-pieter

Description

@protobi-pieter

Problem

After adding package-lock.json (issue #10), we can now run npm audit to identify and fix security vulnerabilities in dependencies.

Current Status

After running npm audit fix:

  • 37 vulnerabilities remain (6 critical, 18 high, 7 moderate, 6 low)
  • Many were fixed automatically (1,131 packages updated)
  • Remaining issues require breaking changes (npm audit fix --force)

Vulnerability Breakdown

Critical (6)

  • flat - Prototype pollution (GHSA-2j2x-2gpw-g8fm)
  • Others in devDependencies (mocha, grunt tooling)

High (18)

Moderate (7)

Impact Assessment

Most vulnerabilities are in devDependencies (test/build tools):

  • Low production risk - Not shipped to users
  • ⚠️ CI/CD risk - Could affect build pipeline security
  • ⚠️ Developer risk - Could affect local development environment

Proposed Solution

Phase 1: Non-Breaking Fixes (DONE in this PR)

  • ✅ Enabled package-lock in .npmrc
  • ✅ Ran npm audit fix (updated 1,131 packages)
  • ✅ Updated many transitive dependencies

Phase 2: Breaking Changes (Requires Testing)

Run npm audit fix --force which will:

  • Update mocha to v11 (from v8) - test framework
  • Update grunt-contrib-jasmine to v4 - test runner
  • Update got to v14 - HTTP library (devDep)

Risk: May break existing tests or build scripts

Phase 3: Manual Updates (If Needed)

Some packages may need manual intervention:

  • Replace deprecated packages (watchify, grunt tooling)
  • Update test configurations
  • Fix any broken tests

Testing Plan

Before merging Phase 2:

  1. Run full test suite: npm test
  2. Run integration tests: npm run test:integration
  3. Test build: npm run build
  4. Verify CI/CD pipeline passes
  5. Manual smoke testing of core functionality

Implementation Steps

# 1. Create branch
git checkout -b fix-audit-vulnerabilities

# 2. Run audit fix with force flag
npm audit fix --force

# 3. Test everything
npm test
npm run test:integration

# 4. Fix any broken tests
# (investigate specific failures)

# 5. Commit and push
git add package-lock.json
git commit -m "Update #N Run npm audit fix --force to address remaining vulnerabilities"
git push origin fix-audit-vulnerabilities

# 6. Create PR for review

Alternative: Manual Updates

If --force breaks too much, manually update problem packages:

npm install mocha@latest --save-dev
npm install grunt-contrib-jasmine@latest --save-dev
# etc.

Security Note

While these are devDependencies, they still matter because:

  • Compromised dev tools can inject malicious code during build
  • CI/CD environments could be exploited
  • Developer machines could be compromised
  • Supply chain attacks often target dev dependencies

References

Metadata

Metadata

Labels

dependenciesPull requests that update a dependency file

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions