Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security advisory for serialize-javascript package #11309

Closed
samelliottdlt opened this issue Aug 11, 2020 · 6 comments
Closed

Security advisory for serialize-javascript package #11309

samelliottdlt opened this issue Aug 11, 2020 · 6 comments

Comments

@samelliottdlt
Copy link

Hey folks 馃憢馃徑

A security advisory was raised by npm for this serialize-javascript package. More info here: https://www.npmjs.com/advisories/1548

Looks like this package is brought in to our dependency trees by way of terser-webpack-plugin. A fix could be to update and publish to the latest version of terser-webpack-plugin which doesn't depend on a vulnerable version of serialize-javascript.

@webmaster128
Copy link

webmaster128 commented Aug 12, 2020

terser-webpack-plugin version ^4, ^3 and ^2 use a sufficiently high version range of serialize-javascript (^4.0.0 and ^3.1.0). So webpack 5 is not affected.

For webpack 4 there is a semver-matching terser-webpack-plugin version 1.4.4 that bumps serialize-javascript from "^2.1.2" to "^3.1.0".

@alexander-akait
Copy link
Member

Please update deps to latest, fixed, all versions of terser-webpacj-plugin using serialize-javascript@4

@trivikr
Copy link

trivikr commented Aug 13, 2020

Is the dependency on vulnerable version of serialize-javascript going to be removed in webpack@4?

Latest version of webpack@4, i.e. v4.44.1 depends on serialize-javascript@2.1.3

webpack/yarn.lock

Lines 5789 to 5792 in cd4af16

serialize-javascript@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61"
integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==

To fix, it needs to be updated to >3.1.0

@trivikr
Copy link

trivikr commented Aug 13, 2020

webpack@4 just need to update it's terser-webpack-plugin dependency to v1.4.5 which updates serialize-javascript package version to 4.0.0

Question: Is this fix going to be released in webpack@4.44.2 or webpack@4.45.0?

@alexander-akait
Copy link
Member

@trivikr update your deps, you need regenerate lock file, it is transitive dep

@trivikr
Copy link

trivikr commented Aug 14, 2020

For those who're visiting this issue from Dependabot security alerts, here is an example PR where dependency is updated aws-samples/aws-sdk-js-tests#47
I just deleted yarn.lock entry for terser-webpack-plugin@^1.4.3 and re-run yarn command. You can do the same for package-lock.json file if you're using npm.

Dependabot cannot automatically create a pull request to fix this as "one or more other dependencies require a version that is incompatible with this update."
As of now, the webpack team is not planning to release a patch version webpack@4 with explicit dependency on terser-webpack-plugin@v1.4.5

phwebi pushed a commit to appfolio/react-gears that referenced this issue Dec 2, 2020
Webpack team is not planning on patching webpack 4 to fix this issue (see webpack/webpack#11309 (comment)). For the mean time, we need to set the right terser-webpack-plugin that doesn't depend on the vulnerable serialize-javascript package.
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

No branches or pull requests

4 participants