Skip to content

fix: bump dependencies to close SLA-breached Snyk CVEs - #1158

Closed
vikrantraut-cstk wants to merge 14 commits into
devfrom
bugfix/snyk-sla-cve-fixes
Closed

vikrantraut-cstk wants to merge 14 commits into
devfrom
bugfix/snyk-sla-cve-fixes

Conversation

@vikrantraut-cstk

@vikrantraut-cstk vikrantraut-cstk commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

🔗 Jira Ticket

Replace with your ticket link — required before requesting review.

MIGRATION-XXXX


📋 PR Type

  • ✨ Feature
  • 🐛 Bug Fix
  • 🔥 Hotfix
  • ♻️ Refactor
  • 🧹 Chore / Dependency Update
  • 📝 Documentation

📝 Description

Bumps dependencies to close the critical, high and medium issues in the Snyk SLA-breach report. It also covers newer advisories on the same packages that npm audit reports, which would otherwise show up in the next report.

It also includes the two customer-reported setup fixes from #1157, which were merged into this branch:

Setup fixes (from #1157)

  • SSO failed after npm run create:env (index.js): the script rewrote api/production.env without MANIFEST_ENCRYPT_KEY and MANIFEST_ENCRYPT_SALT. The API needs them to decrypt the SSO credentials that build.sh encrypts into app.json, so the OAuth callback failed. The script now writes both keys (the same values build.sh uses) and merges into existing env files instead of overwriting them: managed keys are set, other keys and comments are kept.
  • upload-api didn't start on Windows (upload-api/package.json, new upload-api/scripts/build-migrations.js): the build script used a Bash for loop over the migration-* packages, which fails in cmd/PowerShell. It now runs a small Node script that builds each migration-* package in order and stops on the first failure, so npm run build / npm start work the same on Windows, macOS and Linux.

Dependency changes

Package Where Change Advisories closed
axios root (override), ui, api, upload-api ^1.20.0 (resolves 1.21.1); @contentstack/cli-utilities axios override >=1.20.0; @contentstack/venus-components ^3.0.6 (its own axios is 1.20.0) SSRF, prototype pollution, sensitive data in requests, ReDoS, unbounded resource use (fixed in 1.16.0 / 1.18.0), plus newer ones fixed in 1.20.0
react-router / react-router-dom ui ^7.18.7 Deserialization, open redirect, XSS, unbounded resource use, inefficient algorithm (fixed in 7.14–7.18), plus newer ones fixed in 7.18.5
vite ui: ^7.3.8; api and upload-api: vitest's copy now 8.4.0 Directory traversal GHSA-fx2h-pf6j-xcff, plus newer launch-editor / server.fs issues
esbuild api 0.28.2, through tsx 4.23.15 (ui was already on 0.28.1) Insecure download / dev-server file read, fixed in 0.28.1
multer api, upload-api ^2.5.0 Uncontrolled recursion, incomplete cleanup (fixed in 2.2.0), plus newer DoS issues fixed in 2.3–2.5
qs root ^6.17.1; api/upload-api override >=6.16.1 (express pins ~6.15) NULL pointer dereference GHSA-q8mj-m7cp-5q26, plus newer ones fixed in 6.16.1
uuid api, upload-api scoped overrides force ^11.1.1 for @contentstack/json-rte-serializer@<3 and @wordpress/components@<28 only GHSA-w5hq-g745-h8pq (fixed in 11.1.1)
mysql2 api, upload-api ^3.23.1 (resolves 3.26.0) Data amplification SNYK-JS-MYSQL2-19512510 / GHSA-rgwj-5xj2-c3m3: compressed MySQL protocol packets were inflated without a size limit (fixed in 3.23.1)
fast-uri root, api, upload-api override raised from >=4.1.1 to >=4.2.3 (resolves 4.2.4) Interpretation conflict SNYK-JS-FASTURI-19256867 (high, fixed in 4.1.3), which failed the Snyk PR check on api; also covers the newer fast-uri advisories fixed in 4.1.5 and 4.2.3
showdown none No upstream fix exists, but it is no longer a dependency on dev none
  • .talismanrc: allowlists the regenerated lockfiles (Talisman flags their sha512-… integrity hashes, which aren't secrets), plus index.js and build-migrations.js from the setup fixes (index.js holds the default local-setup encryption key and salt, which build.sh already contains).

Why?

  • Dependencies: these issues are past their Snyk SLA windows (15 days for critical, 30 for high, 90 for medium). Several of them, including react-router 7.18.x, multer 2.2.0 and parts of axios, were already fixed on dev. This PR fixes the rest and moves those packages past the newer advisories too.
  • Setup fixes: a customer couldn't sign in with SSO after running create:env, and couldn't start upload-api on Windows.

🧩 Affected Areas

  • api — Node.js backend
  • ui — React frontend
  • upload-api — Upload API server
  • docker / docker-compose
  • CI / GitHub Actions workflows (CODEOWNERS and policy-scan.yml, carried over from main; see Reviewer Notes)
  • Environment variables / config (create:env now writes MANIFEST_ENCRYPT_KEY / MANIFEST_ENCRYPT_SALT)
  • Other: root index.js and package.json (setup helper) and .talismanrc

🧪 How to Test

  1. Run npm ci in ui, api and upload-api.
  2. In ui, run npm run build and npm test.
  3. In api and upload-api, run npm test.
  4. Run npm audit in each project. None of axios, react-router, vite, esbuild, multer, qs, uuid, mysql2, fast-uri or showdown should be listed.
  5. Smoke test: start the app, log in, upload a source file in upload-api (exercises multer), then step through content mapping and run a migration.
  6. create:env: add an extra line (e.g. FOO=bar) to api/production.env, run npm run create:env from the repo root, and check the file now has MANIFEST_ENCRYPT_KEY and MANIFEST_ENCRYPT_SALT and still has FOO=bar. Then sign in with SSO.
  7. Windows: in cmd or PowerShell, run npm run build (or npm start) in upload-api. Each migration-* package should build, then tsc runs.

Expected result: builds and tests pass, none of the listed packages show up in npm audit or Snyk, SSO sign-in works after create:env, and upload-api builds on Windows.


📸 Screenshots / Recordings

N/A, no UI changes beyond dependency bumps.


🔗 Related PRs / Dependencies


✅ Author Checklist

  • Branch follows naming convention: feature/, bugfix/, or hotfix/ + 5–30 lowercase chars
  • Jira ticket linked above
  • Self-reviewed the diff — no debug logs, commented-out code, or TODOs left in
  • .env / example.env updated if new environment variables were added (no new variables)
  • No sensitive credentials or secrets committed
  • Existing tests pass locally (npm test)
  • New tests written (or not applicable — explain why): dependency bumps are covered by the existing suites; the setup scripts have no test harness and were checked by hand (see Reviewer Notes)
  • README.md / docs updated if behaviour changed: not needed, create:env and npm run build are used the same way as before
  • Talisman pre-push scan passes (no secrets flagged)

👀 Reviewer Notes

  • This PR also carries commits that are only on main. fix: keep SSO encryption keys in create:env and make upload-api build cross-platform #1157's branch was cut from main, so merging it brought in 9 main-only commits. Their net effect on dev:

    • CODEOWNERS: the default owner changes from @contentstack/tso-migration-pr-reviewers to @contentstack/tso-integration-pr-reviewers; security-admin now owns all of .github/workflows/, **/CODEOWNERS and **/.gitguardian.yaml. Please confirm dev should take this.
    • .github/workflows/policy-scan.yml: line endings only (LF → CRLF), no content change.
    • sca-scan.yml and issues-jira.yml: no net change against dev.
  • Setup fixes, checked by hand: create:env was run against existing env files (extra keys and comments kept, duplicate managed keys collapsed, missing keys appended), and the new build script was run against stand-in migration-* packages, including a failing one (stops with that package's exit code). It has not been run on a real Windows machine.

  • Verification (Node 20.20 locally; the setup scripts use Node 22):

    • ui: build passes, 346 of 346 tests pass.
    • api: 743 of 743 tests pass, and the server config loads through tsx with esbuild 0.28.
    • upload-api: tsc passes, 302 of 302 tests pass.
  • npm audit, before → after (critical / high):

    Project Before After
    root 0 / 5 0 / 3
    ui 2 / 9 2 / 5
    api 3 / 26 3 / 19
    upload-api 2 / 11 2 / 5

    The remaining criticals and highs are in packages not covered by this report.

  • api build: npm run build fails with 58 TypeScript errors (TS7016 "could not find a declaration file", TS7006, and one TS1470). The same errors happen on dev without this PR, so they aren't caused by it.

  • uuid overrides are deliberately version-scoped: an unscoped @wordpress/components override would also push the newer 35/36 copies from uuid 14 down to 11. uuid 11.1.1 still supports CommonJS require, which the older packages need.

  • ui lockfile: @contentstack/venus-components 3.0.6 brings its own nested react-select / @emotion copies and adds @lottiefiles/dotlottie-react. Please give the UI a quick visual check.

  • upload-api lockfile: a few unrelated lines changed (@wordpress/ui/date-fns and vitest/yaml were removed) because dev's lockfile was slightly out of sync with its package.json.

  • mysql2 is used by the Drupal migration (api/src/services/drupal/*, the upload-api Drupal validator, migration-drupal). Unit tests pass and the type-check shows no new errors, but no test ran against a real MySQL server, so please run a Drupal import before merging.

  • Not run: the apps end to end, and upload-api's per-CMS migration-* package builds.

vikrantraut-cstk and others added 11 commits May 29, 2026 15:47
… cross-platform

- create:env (index.js) now writes MANIFEST_ENCRYPT_KEY and
  MANIFEST_ENCRYPT_SALT to api/production.env. Previously it overwrote the
  file with only APP_TOKEN_KEY and PORT, so the API could not decrypt the
  SSO credentials build.sh encrypted into app.json and the OAuth callback
  failed ("Kindly setup the SSO first"). Env files are now merged: managed
  keys are set, missing ones appended, other keys and comments kept.
- upload-api build replaces the Bash for-loop with
  scripts/build-migrations.js, so npm run build/start work in cmd and
  PowerShell on Windows as well as sh/bash. A failing migration package
  build now stops the build instead of being ignored.
- .talismanrc: allowlist both files. The key/salt values were already
  committed in build.sh and api/production.env.
Raises every package in the Snyk SLA report to a patched version, plus
newer advisories on the same packages that npm audit reports:

- axios ^1.20.0 (root override, ui, api, upload-api; resolves 1.21.1),
  cli-utilities axios override >=1.20.0, venus-components ^3.0.6
- react-router / react-router-dom ^7.18.7 (ui)
- vite ^7.3.8 (ui); vitest's vite now 8.4.0 (api, upload-api)
- esbuild 0.28.2 in api via tsx 4.23.15
- multer ^2.5.0 (api, upload-api)
- qs ^6.17.1 (root) and override >=6.16.1 (api, upload-api)
- uuid ^11.1.1 forced only for @contentstack/json-rte-serializer@<3 and
  @wordpress/components@<28, the two packages still on uuid 8/9
- .talismanrc: allowlist the regenerated lockfiles (integrity hashes)

showdown has no upstream fix and is no longer a dependency on dev.
@snyk-io

snyk-io Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 12 10 ✅ Passed
🟠 High Severity 2 451 25 ✅ Passed
🟡 Medium Severity 3 72 500 ✅ Passed
🔵 Low Severity 0 3 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 8 15 / 30 days ⚠️ Warning
🟠 High 1 380 30 / 120 days ❌ Failed / ⚠️ Warning
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

🟠 High Severity - SLA Breached Issues (with fixes)

Showing 1 issue(s) that have exceeded the 30-day SLA threshold:

  1. Data Amplification
    • ID: SNYK-JS-MYSQL2-19512510
    • Package: mysql2@3.22.5
    • Published: 88 days ago (SLA: 30 days)
    • CVSS Score: 8.2

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 12
  • High without fixes: 451
  • Medium without fixes: 72
  • Low without fixes: 3

❌ BUILD FAILED - Security checks failed

Please review and fix the security vulnerabilities before merging.

mysql2 <= 3.23.0 inflates compressed MySQL protocol packets without a
size limit, so a malicious server can exhaust client memory
(GHSA-rgwj-5xj2-c3m3). Raise mysql2 to ^3.23.1 in api and upload-api
(resolves 3.26.0) and allowlist the regenerated lockfiles in .talismanrc.
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 12 10 ✅ Passed
🟠 High Severity 1 451 25 ✅ Passed
🟡 Medium Severity 3 72 500 ✅ Passed
🔵 Low Severity 0 3 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 8 15 / 30 days ⚠️ Warning
🟠 High 0 380 30 / 120 days ⚠️ Warning
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 12
  • High without fixes: 451
  • Medium without fixes: 72
  • Low without fixes: 3

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@vikrantraut-cstk
vikrantraut-cstk force-pushed the bugfix/snyk-sla-cve-fixes branch from 7d79d93 to 12f72e8 Compare December 1, 2026 10:55
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 12 10 ✅ Passed
🟠 High Severity 1 451 25 ✅ Passed
🟡 Medium Severity 3 72 500 ✅ Passed
🔵 Low Severity 0 3 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 8 15 / 30 days ⚠️ Warning
🟠 High 0 380 30 / 120 days ⚠️ Warning
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 12
  • High without fixes: 451
  • Medium without fixes: 72
  • Low without fixes: 3

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@vikrantraut-cstk
vikrantraut-cstk requested a review from a team as a code owner December 1, 2026 11:05
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 12 10 ✅ Passed
🟠 High Severity 1 451 25 ✅ Passed
🟡 Medium Severity 3 72 500 ✅ Passed
🔵 Low Severity 0 3 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 8 15 / 30 days ⚠️ Warning
🟠 High 0 380 30 / 120 days ⚠️ Warning
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 12
  • High without fixes: 451
  • Medium without fixes: 72
  • Low without fixes: 3

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

The Snyk PR check failed on api/package.json for fast-uri 4.1.2
(interpretation conflict, high, fixed in 4.1.3), pulled in through
@contentstack/cli-utilities. Raise the fast-uri override from >=4.1.1 to
>=4.2.3 in the root, api and upload-api (resolves 4.2.4), which also
covers the newer fast-uri advisories fixed in 4.1.5 and 4.2.3, and
allowlist the regenerated lockfiles in .talismanrc.
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

🔒 Security Scan Results

ℹ️ Note: Only vulnerabilities with available fixes (upgrades or patches) are counted toward thresholds.

Check Type Count (with fixes) Without fixes Threshold Result
🔴 Critical Severity 0 12 10 ✅ Passed
🟠 High Severity 1 431 25 ✅ Passed
🟡 Medium Severity 3 52 500 ✅ Passed
🔵 Low Severity 0 3 1000 ✅ Passed

⏱️ SLA Breach Summary

⚠️ Warning: The following vulnerabilities have exceeded their SLA thresholds (days since publication).

Severity Breaches (with fixes) Breaches (no fixes) SLA Threshold (with/no fixes) Status
🔴 Critical 0 8 15 / 30 days ⚠️ Warning
🟠 High 0 380 30 / 120 days ⚠️ Warning
🟡 Medium 0 0 90 / 365 days ✅ Passed
🔵 Low 0 0 180 / 365 days ✅ Passed

ℹ️ Vulnerabilities Without Available Fixes (Informational Only)

The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:

  • Critical without fixes: 12
  • High without fixes: 431
  • Medium without fixes: 52
  • Low without fixes: 3

⚠️ BUILD PASSED WITH WARNINGS - SLA breaches detected for issues without available fixes

Consider reviewing these vulnerabilities when fixes become available.

@vikrantraut-cstk
vikrantraut-cstk deleted the bugfix/snyk-sla-cve-fixes branch December 1, 2026 11:08
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