Repository navigation
fix: bump dependencies to close SLA-breached Snyk CVEs - #1158
vikrantraut-cstk wants to merge 14 commits into
Conversation
… 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 checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
🟠 High Severity - SLA Breached Issues (with fixes)Showing 1 issue(s) that have exceeded the 30-day SLA threshold:
ℹ️ 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:
❌ 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.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
Consider reviewing these vulnerabilities when fixes become available. |
7d79d93 to
12f72e8
Compare
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
Consider reviewing these vulnerabilities when fixes become available. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
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.
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ 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:
Consider reviewing these vulnerabilities when fixes become available. |
🔗 Jira Ticket
MIGRATION-XXXX
📋 PR Type
📝 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 auditreports, 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)
npm run create:env(index.js): the script rewroteapi/production.envwithoutMANIFEST_ENCRYPT_KEYandMANIFEST_ENCRYPT_SALT. The API needs them to decrypt the SSO credentials thatbuild.shencrypts intoapp.json, so the OAuth callback failed. The script now writes both keys (the same valuesbuild.shuses) and merges into existing env files instead of overwriting them: managed keys are set, other keys and comments are kept.upload-api/package.json, newupload-api/scripts/build-migrations.js): thebuildscript used a Bashforloop over themigration-*packages, which fails in cmd/PowerShell. It now runs a small Node script that builds eachmigration-*package in order and stops on the first failure, sonpm run build/npm startwork the same on Windows, macOS and Linux.Dependency changes
ui,api,upload-api^1.20.0(resolves 1.21.1);@contentstack/cli-utilitiesaxios override>=1.20.0;@contentstack/venus-components^3.0.6(its own axios is 1.20.0)ui^7.18.7ui:^7.3.8;apiandupload-api: vitest's copy now 8.4.0server.fsissuesapitsx4.23.15 (uiwas already on 0.28.1)api,upload-api^2.5.0^6.17.1;api/upload-apioverride>=6.16.1(express pins~6.15)api,upload-api^11.1.1for@contentstack/json-rte-serializer@<3and@wordpress/components@<28onlyapi,upload-api^3.23.1(resolves 3.26.0)api,upload-api>=4.1.1to>=4.2.3(resolves 4.2.4)api; also covers the newer fast-uri advisories fixed in 4.1.5 and 4.2.3dev.talismanrc: allowlists the regenerated lockfiles (Talisman flags theirsha512-…integrity hashes, which aren't secrets), plusindex.jsandbuild-migrations.jsfrom the setup fixes (index.jsholds the default local-setup encryption key and salt, whichbuild.shalready contains).Why?
dev. This PR fixes the rest and moves those packages past the newer advisories too.create:env, and couldn't start upload-api on Windows.🧩 Affected Areas
api— Node.js backendui— React frontendupload-api— Upload API serverdocker/docker-composeCODEOWNERSandpolicy-scan.yml, carried over frommain; see Reviewer Notes)create:envnow writesMANIFEST_ENCRYPT_KEY/MANIFEST_ENCRYPT_SALT)index.jsandpackage.json(setup helper) and.talismanrc🧪 How to Test
npm ciinui,apiandupload-api.ui, runnpm run buildandnpm test.apiandupload-api, runnpm test.npm auditin each project. None of axios, react-router, vite, esbuild, multer, qs, uuid, mysql2, fast-uri or showdown should be listed.FOO=bar) toapi/production.env, runnpm run create:envfrom the repo root, and check the file now hasMANIFEST_ENCRYPT_KEYandMANIFEST_ENCRYPT_SALTand still hasFOO=bar. Then sign in with SSO.npm run build(ornpm start) inupload-api. Eachmigration-*package should build, thentscruns.Expected result: builds and tests pass, none of the listed packages show up in
npm auditor Snyk, SSO sign-in works aftercreate:env, and upload-api builds on Windows.📸 Screenshots / Recordings
N/A, no UI changes beyond dependency bumps.
🔗 Related PRs / Dependencies
dev(e002672).main), merged into this branch. Once this PR lands ondev, fix: keep SSO encryption keys in create:env and make upload-api build cross-platform #1157 can be closed or left to carry the same fix tomain.✅ Author Checklist
feature/,bugfix/, orhotfix/+ 5–30 lowercase chars.env/example.envupdated if new environment variables were added (no new variables)npm test)README.md/ docs updated if behaviour changed: not needed,create:envandnpm run buildare used the same way as before👀 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 frommain, so merging it brought in 9main-only commits. Their net effect ondev:CODEOWNERS: the default owner changes from@contentstack/tso-migration-pr-reviewersto@contentstack/tso-integration-pr-reviewers;security-adminnow owns all of.github/workflows/,**/CODEOWNERSand**/.gitguardian.yaml. Please confirmdevshould take this..github/workflows/policy-scan.yml: line endings only (LF → CRLF), no content change.sca-scan.ymlandissues-jira.yml: no net change againstdev.Setup fixes, checked by hand:
create:envwas 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-inmigration-*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 throughtsxwith esbuild 0.28.upload-api:tscpasses, 302 of 302 tests pass.npm audit, before → after (critical / high):uiapiupload-apiThe remaining criticals and highs are in packages not covered by this report.
apibuild:npm run buildfails with 58 TypeScript errors (TS7016 "could not find a declaration file", TS7006, and one TS1470). The same errors happen ondevwithout this PR, so they aren't caused by it.uuid overrides are deliberately version-scoped: an unscoped
@wordpress/componentsoverride would also push the newer 35/36 copies from uuid 14 down to 11. uuid 11.1.1 still supports CommonJSrequire, which the older packages need.uilockfile:@contentstack/venus-components3.0.6 brings its own nestedreact-select/@emotioncopies and adds@lottiefiles/dotlottie-react. Please give the UI a quick visual check.upload-apilockfile: a few unrelated lines changed (@wordpress/ui/date-fnsandvitest/yamlwere removed) becausedev's lockfile was slightly out of sync with itspackage.json.mysql2 is used by the Drupal migration (
api/src/services/drupal/*, theupload-apiDrupal 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-CMSmigration-*package builds.