Skip to content

fix: update serialize-javascript to >=7.0.3#592

Open
Anshumancanrock wants to merge 1 commit intocameri:mainfrom
Anshumancanrock:fix-serialize-javascript
Open

fix: update serialize-javascript to >=7.0.3#592
Anshumancanrock wants to merge 1 commit intocameri:mainfrom
Anshumancanrock:fix-serialize-javascript

Conversation

@Anshumancanrock
Copy link
Copy Markdown
Collaborator

Description

This PR adds a pnpm.overrides entry to force serialize-javascript to >=7.0.3, resolving a high-severity RCE vulnerability (GHSA-5c6j-r48x-rmvq, CVSS 8.1).

The package isn't a direct dependency — it's pulled in transitively via mocha → serialize-javascript@^6.0.2. Since mocha upstream hasn't bumped this yet, the only correct fix is overriding the resolution at the workspace level using pnpm's native override mechanism.

Related Issue

Closes #521

Motivation and Context

serialize-javascript <=7.0.2 allows code injection through spoofed RegExp.flags and Date.toISOString() properties. When the serialized output is eval'd, the injected code executes. Mocha uses this package in its parallel worker pool (buffered-worker-pool.js) to serialize test options between the main process and worker threads.

While this is a devDependency and not reachable at relay runtime, it still poses a risk in CI environments and developer machines. Patching it is the right call.

How Has This Been Tested?

Manual PoC verification: Ran the CVE proof-of-concept against both versions:

  • serialize-javascript@6.0.2 → injection succeeds silently
  • serialize-javascript@7.0.5 (installed after override) → throws "RegExp.prototype.source getter called on non-RegExp object", injection neutralized

Screenshots (if appropriate):

N/A

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • I added a changeset, or this is docs-only and I added an empty changeset.
  • All new and existing tests passed.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: 1aa065f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 30, 2026

Coverage Status

coverage: 64.591% (+0.01%) from 64.58% — Anshumancanrock:fix-serialize-javascript into cameri:main

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR mitigates a high-severity RCE vulnerability in the transitive devDependency serialize-javascript by forcing pnpm to resolve it to a patched version across the workspace.

Changes:

  • Added a pnpm workspace override for serialize-javascript to require >=7.0.3.
  • Regenerated pnpm-lock.yaml to reflect resolution to serialize-javascript@7.0.5 and removal of no-longer-needed transitive deps.
  • Added a Changeset marking a patch release for the security-related dependency resolution change.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
package.json Introduces pnpm override configuration to force patched serialize-javascript.
pnpm-lock.yaml Captures the override in the lockfile and updates resolved dependency graph (now serialize-javascript@7.0.5).
.changeset/fix-serialize-javascript-cve.md Adds a patch changeset documenting the security fix.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json Outdated
Comment on lines +179 to +184
"axios@<0.31.0": ">=0.31.0"
},
"pnpm": {
"overrides": {
"serialize-javascript": ">=7.0.3"
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Anshumancanrock Good point, can we consolidate this with the top overrides field?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hii @cameri Actually the top-level overrides field is npm syntax , pnpm v10 ignores it entirely, so consolidating there wouldn't actually do anything. I went ahead and removed that legacy field entirely and kept only pnpm.overrides, so there's a single place now.

Comment thread package.json Outdated
},
"pnpm": {
"overrides": {
"serialize-javascript": ">=7.0.3"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Anshumancanrock Good point, I think we should add the <8

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, updated pinned to >=7.0.3 <8 .

@Anshumancanrock Anshumancanrock force-pushed the fix-serialize-javascript branch from 6db254a to 65ff30b Compare May 1, 2026 05:36
@Anshumancanrock Anshumancanrock force-pushed the fix-serialize-javascript branch from 65ff30b to 1aa065f Compare May 1, 2026 05:42
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.

Security: Update serialize-javascript to 7.0.3 (CVE RCE)

4 participants