Skip to content

fix(security): remove transitive serialize-javascript@6.x from mc-scripts#3986

Merged
misama-ct merged 1 commit intomainfrom
fix-serialize-javascript
Apr 30, 2026
Merged

fix(security): remove transitive serialize-javascript@6.x from mc-scripts#3986
misama-ct merged 1 commit intomainfrom
fix-serialize-javascript

Conversation

@misama-ct
Copy link
Copy Markdown
Contributor

@misama-ct misama-ct commented Apr 28, 2026

Summary

  • Bumps terser-webpack-plugin to ^5.5.0 (no longer depends on serialize-javascript as of 5.4.0).
  • Bumps css-minimizer-webpack-plugin to ^8.0.0 (declares serialize-javascript: ^7.0.3).
  • Bumps postcss to ^8.5.12 to satisfy cssnano@7's peer dep introduced by the above.
  • Drops Node 18 from mc-scripts engines (now 20.x || >=22.0.0) to match css-minimizer-webpack-plugin@8's >= 20.9 requirement.

Why

Customer ticket SUPPORT-40033 reported that our previous security fix only patched one of three transitive serialize-javascript@6.0.2 paths (GHSA-5c6j-r48x-rmvq). The pnpm.overrides declaration in our root package.json does not propagate to published packages — it only affects local installs inside this monorepo. As a result, consumers' fresh installs still resolved vulnerable copies via css-minimizer-webpack-plugin@3.4.1 and terser-webpack-plugin@5.3.14.

This PR fixes the issue at the spec-range level so consumers' installs naturally land on safe versions, with no overrides required on their side.

Test plan

  • pnpm install clean — no new peer dep warnings
  • Lockfile contains only serialize-javascript@7.0.5
  • preconstruct build succeeds
  • jest mc-scripts unit tests pass (79/79)
  • Starter template production build succeeds (webpack runs new minifiers end-to-end, all bundles minified, HTML compiled)
  • Visual regression test against a downstream consumer app via the preview release tag — see canary validation comment

…cripts dep tree

Bumps `terser-webpack-plugin` to `^5.5.0` (drops the `serialize-javascript`
dep entirely as of 5.4.0) and `css-minimizer-webpack-plugin` to `^8.0.0`
(declares `serialize-javascript: ^7.0.3`). Also bumps `postcss` to `^8.5.12`
to satisfy `cssnano@7`'s peer dependency, and drops Node 18 from the
supported engines to match `css-minimizer-webpack-plugin@8`'s `>= 20.9`
requirement.

Eliminates GHSA-5c6j-r48x-rmvq from downstream consumers' dep graphs without
relying on the repo-local `pnpm.overrides` (which does not propagate to
published packages).
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

🦋 Changeset detected

Latest commit: edfd3f2

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

This PR includes changesets to release 36 packages
Name Type
@commercetools-frontend/mc-scripts Minor
@commercetools-applications/merchant-center-template-starter-typescript Minor
@commercetools-applications/merchant-center-template-starter Minor
@commercetools-applications/merchant-center-custom-view-template-starter-typescript Minor
@commercetools-applications/merchant-center-custom-view-template-starter Minor
@commercetools-local/playground Minor
@commercetools-backend/eslint-config-node Minor
@commercetools-backend/express Minor
@commercetools-backend/loggers Minor
@commercetools-frontend/actions-global Minor
@commercetools-frontend/application-components Minor
@commercetools-frontend/application-config Minor
@commercetools-frontend/application-shell-connectors Minor
@commercetools-frontend/application-shell Minor
@commercetools-frontend/assets Minor
@commercetools-frontend/babel-preset-mc-app Minor
@commercetools-frontend/browser-history Minor
@commercetools-frontend/codemod Minor
@commercetools-frontend/constants Minor
@commercetools-frontend/create-mc-app Minor
@commercetools-frontend/cypress Minor
@commercetools-frontend/eslint-config-mc-app Minor
@commercetools-frontend/i18n Minor
@commercetools-frontend/jest-preset-mc-app Minor
@commercetools-frontend/jest-stylelint-runner Minor
@commercetools-frontend/l10n Minor
@commercetools-frontend/mc-dev-authentication Minor
@commercetools-frontend/mc-html-template Minor
@commercetools-frontend/notifications Minor
@commercetools-frontend/permissions Minor
@commercetools-frontend/react-notifications Minor
@commercetools-frontend/sdk Minor
@commercetools-frontend/sentry Minor
@commercetools-frontend/url-utils Minor
@commercetools-local/visual-testing-app Minor
@commercetools-website/components-playground Minor

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mc-app-kit-playground Ready Ready Preview, Comment Apr 28, 2026 8:30am
merchant-center-application-kit-components-playground Ready Ready Preview, Comment Apr 28, 2026 8:30am

Request Review

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.93%. Comparing base (66a5c17) to head (edfd3f2).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3986   +/-   ##
=======================================
  Coverage   72.93%   72.93%           
=======================================
  Files         267      267           
  Lines        7102     7102           
  Branches     2211     2241   +30     
=======================================
  Hits         5180     5180           
  Misses       1899     1899           
  Partials       23       23           
Components Coverage Δ
Application Components 81.18% <ø> (ø)
Application Shell 74.54% <ø> (ø)
Application Shell Connectors 77.54% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 66a5c17...edfd3f2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@misama-ct
Copy link
Copy Markdown
Contributor Author

[preview_deployment]

@github-actions
Copy link
Copy Markdown
Contributor

Release workflow succeeded ✅\nSee details: Workflow Run

@misama-ct misama-ct marked this pull request as ready for review April 28, 2026 13:59
@misama-ct misama-ct requested a review from a team as a code owner April 28, 2026 13:59
@misama-ct
Copy link
Copy Markdown
Contributor Author

Canary validation complete

The [preview_deployment] canary (0.0.0-fix-serialize-javascript-20260428090559) was installed in the Merchant Center frontend repo (consumer-side PR: commercetools/merchant-center-frontend#20586), and CI now passes.

Initial test failures (resolved, unrelated to this PR)

A first install via pnpm update <pkg>@fix-serialize-javascript produced two physical copies of @commercetools-frontend/application-shell-connectors due to a peer-dep variant on @types/node (24.x vs newly-published 25.x), causing duplicate React Context instances and downstream test failures (useSkipCookieConsent reading context.environment as undefined; Cypress login form failing to mount). Root-caused to pnpm update re-resolving the entire transitive graph and discovering a newer @types/node on npm — not a code regression in this PR. Resolved consumer-side by pinning @types/node in pnpm.overrides.

Confirms

  • Vulnerability fix works: serialize-javascript@6.x no longer in the consumer's resolved tree.
  • No build, runtime, or visual regression introduced by terser-webpack-plugin@^5.5.0 + css-minimizer-webpack-plugin@^8.0.0 + postcss@^8.5.12 + cssnano@7.

Ready for review.

@misama-ct misama-ct requested a review from a team April 28, 2026 14:00
@misama-ct misama-ct self-assigned this Apr 28, 2026
@misama-ct misama-ct merged commit 6fc29f1 into main Apr 30, 2026
21 checks passed
@misama-ct misama-ct deleted the fix-serialize-javascript branch April 30, 2026 10:09
@ct-changesets ct-changesets Bot mentioned this pull request Apr 30, 2026
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.

4 participants