[APS-18800] fix(security): upgrade serialize-javascript to 7.0.3 to fix RCE#1096
Open
karanshah-browserstack wants to merge 1 commit intomasterfrom
Open
[APS-18800] fix(security): upgrade serialize-javascript to 7.0.3 to fix RCE#1096karanshah-browserstack wants to merge 1 commit intomasterfrom
karanshah-browserstack wants to merge 1 commit intomasterfrom
Conversation
…[APS-18800] Fixes GHSA-5c6j-r48x-rmvq (RCE) and GHSA-qj8w-gfj5-8c6v (DoS) in the transitive serialize-javascript dependency pulled in by mocha. Uses npm's native `overrides` field — no third-party workarounds needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37bfe34 to
21f71a0
Compare
avinash-bharti
approved these changes
May 7, 2026
Jimesh-browserstack
approved these changes
May 7, 2026
Collaborator
Jimesh-browserstack
left a comment
There was a problem hiding this comment.
LGTM — Independent validation passes
Approving on behalf of APS-18800 (assignee). Re-ran the full validation locally on Node 20 / npm 10 with master as baseline.
Comparative regression test (npm test on both branches)
| Branch | serialize-javascript resolved | npm audit (high) | passing | failing | pending |
|---|---|---|---|---|---|
master (ef06797, baseline) |
6.0.2 (vulnerable) |
3 high | 663 | 13 | 2 |
this branch (21f71a0) |
7.0.5 overridden |
0 | 663 | 13 | 2 |
The 13 failures and 2 pendings are identical on both branches — pre-existing, not regressions from this change. Numbers match the PR description exactly.
Why this is the right fix
serialize-javascriptis a transitive devDep (chain:mocha@10.8.2 → serialize-javascript); cannot be bumped directly. npmoverridesis the correct mechanism.mochais the unit-test runner only (nyc mocha 'test/**/*.js'). No production code path underbin/imports it. So no runtime surface area is affected, and a live BrowserStack session is not required to validate this change.npm ls serialize-javascriptconfirms the override:browserstack-cypress-cli@1.36.5 └─┬ mocha@10.8.2 └── serialize-javascript@7.0.5 overriddennpm auditreports 0 vulnerabilities on this branch (vs. 3 high on master).- Both GHSA-5c6j-r48x-rmvq (RCE, CVSS 8.1) and GHSA-qj8w-gfj5-8c6v (DoS, CVSS 5.9) are resolved.
Notes
- A second PR (#1097) with the same head SHA
21f71a0was already merged intopre_prod~30 seconds after this PR was opened, so the fix is propagated to pre-prod. package-lock.jsonregenerates tolockfileVersion: 3(npm 10 default). This is acceptable; the previous v1 was a legacy artifact.
Resolves: APS-18800
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.
Security Fix: APS-18800
Issue
`serialize-javascript` versions <= 7.0.4 are vulnerable to:
Both affect the transitive dependency chain: `mocha@10.8.2` → `serialize-javascript@6.0.2`.
Fix Applied
Used npm's native `overrides` field (npm 7+) to pin `serialize-javascript` to `>=7.0.5`:
```json
"overrides": {
"serialize-javascript": ">=7.0.5"
}
```
`serialize-javascript` is a transitive dependency (via `mocha`) so it cannot be bumped directly. The `overrides` field is the official npm mechanism for this — no third-party tools or preinstall hacks needed.
`mocha` is used only as the test runner (`nyc mocha 'test/**/*.js' ...`), not in any production code path invoked by end users of the CLI.
Verification
`npm ls serialize-javascript` confirms the override:
```
browserstack-cypress-cli@1.36.5
└─┬ mocha@10.8.2
└── serialize-javascript@7.0.5 overridden
```
`npm audit` reports 0 vulnerabilities. Both GHSA-5c6j-r48x-rmvq and GHSA-qj8w-gfj5-8c6v are absent.
`package-lock.json` is regenerated at `lockfileVersion: 3` (npm 10 on Node 20, which is the current environment). This is expected and acceptable — the old lockfileVersion 1 was a legacy artifact.
Testing
Comparative regression test (same `npm test` command on both branches):
Failing tests are identical on both branches — pre-existing failures, not regressions from this change.
Jira Ticket
APS-18800
Checklist