fix: upgrade serialize-javascript to 7.0.3 (GHSA-5c6j-r48x-rmvq)#128
Draft
fix: upgrade serialize-javascript to 7.0.3 (GHSA-5c6j-r48x-rmvq)#128
Conversation
…HSA-5c6j-r48x-rmvq Agent-Logs-Url: https://github.com/github/request-marketplace-action/sessions/b2c4683a-207e-4326-b808-84d5c08b9c8c Co-authored-by: lindluni <9400927+lindluni@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix vulnerability in serialize-javascript package
fix: upgrade serialize-javascript to 7.0.3 (GHSA-5c6j-r48x-rmvq)
Apr 2, 2026
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
serialize-javascript≤7.0.2 allows RCE via spoofedRegExp.flagsorDate.prototype.toISOString()— an incomplete fix for CVE-2020-7660. The vulnerable package enters viamocha@11.7.5, which pinsserialize-javascript ^6.0.2.Changes
.github/scripts/package.json— addsoverridesto forceserialize-javascriptto7.0.3, since mocha's own peer constraint blocks the automatic upgrade:.github/scripts/package-lock.json— regenerated;node_modules/serialize-javascriptnow resolves to7.0.3.Reachability
serialize-javascriptis not called by any application code — only used internally by mocha's test worker. The vulnerable API (attacker-controlledRegExp/Datewith spoofed properties passed toserialize()) is never reachable from this codebase. Update addresses scanner findings rather than an active exploit path. Confidence: high.Original prompt
This section details the Dependabot vulnerability alert you should resolve
<alert_title>Serialize JavaScript is Vulnerable to RCE via RegExp.flags and Date.prototype.toISOString()</alert_title>
<alert_description>### Impact
The serialize-javascript npm package (versions <= 7.0.2) contains a code injection vulnerability. It is an incomplete fix for CVE-2020-7660.
While
RegExp.sourceis sanitized,RegExp.flagsis interpolated directly into the generated output without escaping. A similar issue exists inDate.prototype.toISOString().If an attacker can control the input object passed to
serialize(), they can inject malicious JavaScript via the flags property of a RegExp object. When the serialized string is later evaluated (viaeval,new Function, or<script>tags), the injected code executes.Patches
The fix has been published in version 7.0.3. https://github.com/yahoo/serialize-javascript/releases/tag/v7.0.3</alert_description>
high
https://github.com/yahoo/serialize-javascript/security/advisories/GHSA-5c6j-r48x-rmvq https://nvd.nist.gov/vuln/detail/CVE-2020-7660 https://github.com/yahoo/serialize-javascript/commit/2e609d0a9f4f5b097f0945af88bd45b9c7fb48d9 https://github.com/advisories/GHSA-hxcc-f52p-wc94 https://github.com/yahoo/serialize-javascript/releases/tag/v7.0.3 https://github.com/advisories/GHSA-5c6j-r48x-rmvqGHSA-5c6j-r48x-rmvq
serialize-javascript
npm
<vulnerable_versions>6.0.2</vulnerable_versions>
<patched_version>7.0.3</patched_version>
<manifest_path>.github/scripts/package-lock.json</manifest_path>
<task_instructions>Resolve this alert by updating the affected package to a non-vulnerable version. Prefer the lowest non-vulnerable version (see the patched_version field above) over the latest to minimize breaking changes. Include a Reachability Assessment section in the PR description. Review the alert_description field to understand which APIs, features, or configurations are affected, then search the codebase for usage of those specific items. If the vulnerable code path is reachable, explain how (which files, APIs, or call sites use the affected functionality) and note that the codebase is actively exposed to this vulnerability. If the vulnerable code path is not reachable, explain why (e.g. the affected API is never called, the vulnerable configuration is not used) and note that the update is primarily to satisfy vulnerability scanners rather than to address an active risk. If the advisory is too vague to determine reachability (e.g. 'improper input validation' with no specific API named), state that reachability could not be determined and explain why. Include a confidence level in the reachability assessment (e.g. high confidence if the advisory names a specific API and you confirmed it is or is not called, low confidence if the usage is indirect and hard to trace). If no patched version is available, check the alert_description field for a Workarounds section — the advisory may describe configuration changes or usage pa...