Skip to content

[BMU-2743] Upgrade jsondiffpatch - Security Vulnerability - #60

Merged
marcelogpinheiro merged 7 commits into
mainfrom
BMU-2743_upgrade-jsondiffpatch
Jul 2, 2026
Merged

[BMU-2743] Upgrade jsondiffpatch - Security Vulnerability #60
marcelogpinheiro merged 7 commits into
mainfrom
BMU-2743_upgrade-jsondiffpatch

Conversation

@marcelogpinheiro

@marcelogpinheiro marcelogpinheiro commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Upgrade jsondiffpatch from 0.5.0 to 0.7.6

Bumps jsondiffpatch in packages/sync-actions from 0.5.0 to ^0.7.6 to fix security vulnerabilities in 0.5.0.

Why the config changes were needed

0.7 is ESM-only with breaking API changes, so a few adjustments were required:

  • jest.config.js (root) + packages/sync-actions/jest.config.js — Jest skips node_modules by default, so the ESM package threw Cannot use import statement outside a module. Added transformIgnorePatterns: ['/node_modules/(?!(jsondiffpatch)/)'] to transpile it. The root config is the one CI uses.
  • package.json (root) — bumped typescript ^4.6.2^5.8.2, required by 0.7's type definitions.
  • src/utils/diffpatcher.ts — new import path (jsondiffpatch); dropped textDiff.minLength (text diffing is opt-in in 0.7, and whole-value replacement is what we want); patch() now returns unknown, narrowed back to T.
  • src/utils/types.ts — replaced jsondiffpatch's strict Delta type with a loose Record<string | number, any>, since builders index deltas by key and position.

Tests added in test/utils/diffpatcher.spec.ts.

@marcelogpinheiro
marcelogpinheiro requested a review from a team June 30, 2026 08:16
@marcelogpinheiro marcelogpinheiro self-assigned this Jun 30, 2026
@marcelogpinheiro
marcelogpinheiro requested a review from a team as a code owner June 30, 2026 08:16
@marcelogpinheiro marcelogpinheiro changed the title Bmu 2743 upgrade jsondiffpatch [BMU-2743] Upgrade jsondiffpatch - Security Vulnerability Jun 30, 2026
@marcelogpinheiro
marcelogpinheiro marked this pull request as draft June 30, 2026 10:34
@marcelogpinheiro

Copy link
Copy Markdown
Contributor Author

I'm checking the pipeline tests...

@changeset-bot

changeset-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cc3b3cd

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

This PR includes changesets to release 1 package
Name Type
@commercetools/sync-actions 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

@marcelogpinheiro
marcelogpinheiro marked this pull request as ready for review June 30, 2026 11:10
@marcelogpinheiro
marcelogpinheiro marked this pull request as draft June 30, 2026 11:15
@marcelogpinheiro
marcelogpinheiro marked this pull request as ready for review June 30, 2026 11:20

@islam3zzat islam3zzat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, could we remove the code comments that are related to this upgrade.

@marcelogpinheiro
marcelogpinheiro merged commit e3b3753 into main Jul 2, 2026
10 checks passed
@ct-changesets ct-changesets Bot mentioned this pull request Jul 2, 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.

2 participants