-
Notifications
You must be signed in to change notification settings - Fork 38
Security: Fix serialize-javascript vulnerability (CVE-2020-7660) #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,40 @@ | ||||||
| # Security Fix: serialize-javascript vulnerability (CVE-2020-7660) | ||||||
|
|
||||||
| ## Issue | ||||||
| The serialize-javascript npm package (versions <= 7.0.2) contained a code injection vulnerability. This was an incomplete fix for CVE-2020-7660. | ||||||
|
|
||||||
| ## Problem | ||||||
| - mocha@10.8.2 required serialize-javascript@^6.0.2 | ||||||
| - No patched version was available in the 6.x series | ||||||
| - The earliest fixed version is 7.0.5 | ||||||
|
|
||||||
| ## Solution | ||||||
| 1. **Updated Mocha**: Upgraded to mocha@^11.0.0 (latest stable) | ||||||
| 2. **Added Override**: Used npm `overrides` to force serialize-javascript@^7.0.5 | ||||||
| 3. **Engine Requirement**: Updated Node.js requirement to >=18.18.0 to support newer dependencies | ||||||
|
|
||||||
| ## Changes Made | ||||||
|
|
||||||
| ### package.json | ||||||
| - `mocha`: Updated from `^10.0.0` to `^11.0.0` | ||||||
| - `engines.node`: Updated from `>=14.20.0` to `>=18.18.0` | ||||||
| - Added `overrides` section to force `serialize-javascript@^7.0.5` | ||||||
|
|
||||||
| ### Result | ||||||
| - ✅ serialize-javascript vulnerability resolved (7.0.5 installed) | ||||||
| - ✅ npm audit no longer shows serialize-javascript vulnerability | ||||||
| - ⚠️ Node.js >=18.18.0 now required | ||||||
|
|
||||||
| ## Verification | ||||||
| ```bash | ||||||
| npm ls serialize-javascript | ||||||
| # Shows: serialize-javascript@7.0.5 | ||||||
|
|
||||||
| npm audit | ||||||
| # No longer reports serialize-javascript vulnerability | ||||||
| ``` | ||||||
|
|
||||||
| ## Compatibility | ||||||
| This fix requires Node.js >=18.18.0. Projects using older Node.js versions will need to upgrade. | ||||||
|
|
||||||
| For production deployments, ensure Node.js version meets the new requirement. | ||||||
|
||||||
| For production deployments, ensure Node.js version meets the new requirement. | |
| For production deployments, ensure the Node.js version is >=18.18.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc claims
serialize-javascript@7.0.5is installed, butpackage.jsonuses an override range (^7.0.5), so the installed version may be newer than 7.0.5. To keep this doc accurate over time, describe it as>=7.0.5(or “7.0.5+”) and/or show an example output rather than an exact version.