Repository navigation
fix: keep SSO encryption keys in create:env and make upload-api build cross-platform - #1157
Conversation
…esModal with async handling for step changes
…le package.json and package-lock.json files
…r better handling of missing and media blocks
…aveChangesModal with async handling for step changes" This reverts commit fe3bfed.
…iple package.json and package-lock.json files
…ng and jetpack/story support - Added `unwrapSingleChildGroup` function to simplify processing of core/group blocks with a single inner block. - Updated `createSchema` to utilize the new function for better handling of nested structures. - Enhanced `schemaMapper` to support jetpack/story blocks, mapping them to a repeatable group with title, alt, caption, and image fields. - Improved unit tests to validate new functionality for single-child groups and jetpack/story mappings.
…nfig - Extract and map Contentful taxonomies from export; upload-api and mapper integration - Contentful service: field/widget helpers, taxonomy metadata locale resolution (mapper + sys.locale) - API: Vitest thresholds; migration and user unit tests (SSO, createTaxonomy mocks) - app.json placeholder updates and related fixes
…ganization validation - Updated saveOAuthToken to render HTML success and error pages upon OAuth token exchange. - Introduced organization validation to ensure the correct organization is linked during authorization. - Normalized Contentstack OAuth URLs to avoid issues with hash-style URLs. - Added utility functions for building HTML responses and escaping text for safety. - Enhanced the Login component to handle SSO success and error notifications. - Added unit tests for new utility functions and updated existing tests for auth controller.
…ty tests - Decreased the branch coverage threshold from 56 to 55 in Vitest configuration. - Added a new test case to the contentstack-oauth-url utility to handle empty or non-string inputs correctly.
- Moved region configuration to a dedicated constants file for better organization and maintainability. - Updated various services and components to utilize the new REGION_CONFIG, ensuring optional chaining is applied for safer access to properties. - Corrected the spelling of 'failureNotification' in multiple locations for consistency.
- Removed unnecessary console logging in contentMapper service. - Introduced `normalizeNicenameForUid` function to standardize taxonomy UIDs by replacing hyphens and spaces with underscores. - Enhanced `formatChildByType` to handle child elements more robustly, ensuring correct extraction of attributes and inner blocks. - Updated `extractItems` and `extractTaxonomy` to utilize the new normalization function for consistent taxonomy UID generation. - Improved schema mapping for cover blocks to ensure proper handling of inner blocks and attributes.
…d a Set to track source content type UIDs for improved filtering.
- Introduced `getAxiosResponseHeader` to handle both AxiosHeaders and plain object headers, improving header value retrieval. - Updated asset validation to utilize the new function for content-type checks, enhancing robustness in asset validation logic.
…tallations - Updated createAppManifest to support fetching marketplace installations when the extension mapper file is missing. - Introduced marketplaceSourceStackId parameter to allow specifying the source stack for installations. - Added error handling for installation fetching and ensured proper writing of the app manifest. - Enhanced unit tests to cover new functionality and edge cases related to marketplace installations.
…Stack function - Introduced tests for the fetchMarketplaceInstallationsForStack function to validate pagination handling, error scenarios, and logging behavior. - Ensured proper aggregation of installations based on stack UID and added fallback mechanisms for failed fetch attempts. - Enhanced test coverage for various edge cases, including handling of non-Error exceptions.
- Replaced with for child block UIDs to preserve existing digit-prefixed UIDs during merging. - Added function to enhance matching logic by allowing fallback to title for blocks with diverged UIDs. - Updated merging process to align UIDs and titles with the destination blocks, preventing the creation of duplicates.
- Upgraded @contentstack/cli-utilities to version 1.18.3. - Updated @contentstack/marketplace-sdk to version 1.5.2. - Adjusted axios version to 1.15.2 and uuid to 14.0.0. - Added short-uuid as a new dependency. - Updated other related dependencies for improved compatibility and performance.
- Replaced inline REGION_CONFIG object in index.ts with import from region-config.json for better maintainability. - Updated sso.utils.js to reference the new JSON configuration. - Removed redundant region configuration code from index.ts.
- Introduced hasMeaningfulHtmlContent function to determine if HTML contains substantive content. - Added attachCoverBackgroundMediaToChildren and attachMediaTextFieldsToChildren functions for improved media handling in core blocks. - Updated createSchema and schemaMapper functions to accommodate new media-text block processing. - Refined logic in extractItems and updated MIME type handling in getMimeTypeFromExtension for better robustness.
- Upgraded @contentstack/marketplace-sdk to version 1.5.2. - Updated axios to version 1.16.0 and follow-redirects to version 1.16.0. - Added react-toastify for improved user notifications during SSO flow. - Implemented toast dismissal logic to enhance user experience during SSO process.
…e-value fields correctly
Delta Migration | 1.0.0 | In Drupal Assets are not getting attached to entries
Bugfix/cmg 1109 1004 fixes
usedEntryUids was reserving modelId::locale unconditionally right after computing uid, before the later contentType/mappedLocale check decided whether an entry would actually be produced. A file that fell into the "no content type matched" branch (e.g. a template structure export with no mapped content type) still consumed the key — permanently blocking a sibling file sharing that key from producing the real entry, leaving zero entries instead of one. That's the same "structure entry missing" symptom QA reopened CMG-1112 for, now made deterministic by the added sort instead of order-dependent. Move the reservation into the success branch so a non-producing file never blocks its sibling, while still guaranteeing at most one entry per modelId::locale.
Reverts upload-api/src/config/index.ts and index.json to match dev exactly. These were unrelated trailing-comma/trailing-newline diffs that had ridden along in this branch's history, not part of the CMG-1112 fix (flagged in PR review).
fix: stop excluding AEM structure entry from migration (CMG-1112)
… 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.
✅ 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
🔴 Critical Severity - SLA Breached Issues (with fixes)Showing 3 issue(s) that have exceeded the 15-day SLA threshold:
🟠 High Severity - SLA Breached Issues (with fixes)Showing 20 issue(s) that have exceeded the 30-day SLA threshold:
🟡 Medium Severity - SLA Breached Issues (with fixes)Showing 20 issue(s) that have exceeded the 90-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. |
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.
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.
5b2253b to
bb861f1
Compare
🔒 Security Scan Results
⏱️ SLA Breach Summary
🔴 Critical Severity - SLA Breached Issues (with fixes)Showing 3 issue(s) that have exceeded the 15-day SLA threshold:
🟠 High Severity - SLA Breached Issues (with fixes)Showing 20 issue(s) that have exceeded the 30-day SLA threshold:
🟡 Medium Severity - SLA Breached Issues (with fixes)Showing 20 issue(s) that have exceeded the 90-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. |
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.
Bugfix/snyk sla CVE fixes
🔒 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
Fixes two setup problems a customer reported.
What changed?
index.js(npm run create:env) now writesMANIFEST_ENCRYPT_KEYandMANIFEST_ENCRYPT_SALTtoapi/production.env, using the same valuesbuild.shuses for encryption.index.jsmerges into existing env files instead of replacing them: the keys it manages are set, missing ones are added, and any other keys and comments stay as they are.upload-api/package.json:buildnow runsnode scripts/build-migrations.js && tscinstead of a Bashforloop.upload-api/scripts/build-migrations.js(new) runsnpm run buildin eachmigration-*folder that has apackage.json, on Windows (cmd/PowerShell) and in sh/bash..talismanrc: allowlists the two files above (see Reviewer Notes).Why?
create:envruns from bothsetup.shandsetup-continue.bat. It overwroteapi/production.envwith onlyAPP_TOKEN_KEYandPORT, which removed the encryption key and salt. The API then couldn't decrypt theclient_id/client_secretthatbuild.shencrypts intoapp.json, becausecrypto.utils.tsthrows. This affects macOS and Windows. The customer confirmed that adding both keys back fixes it.buildfailed. Sincestartrunsbuildfirst,localhost:4002/confignever came up. Moving the loop to Node fixes this for every OS without separatewin*scripts or changes tosetup-continue.bat.🧩 Affected Areas
api— Node.js backendui— React frontendupload-api— Upload API serverdocker/docker-composeindex.js/npm run create:env)🧪 How to Test
npm run create:envat the repo root.api/production.envshould containAPP_TOKEN_KEY,PORT,MANIFEST_ENCRYPT_KEYandMANIFEST_ENCRYPT_SALT. Add a custom line (for exampleFOO=bar) to any of the three env files and run it again: that line should still be there.build.sh, thensetup.sh(orsetup.baton Windows), and log in with SSO.npm install && npm run startinupload-api. Everymigration-*package should build, andhttp://localhost:4002/configshould respond.Expected result: SSO login succeeds after setup, and upload-api starts on Windows, macOS and Linux.
📸 Screenshots / Recordings
N/A, no UI changes.
🔗 Related PRs / Dependencies
✅ Author Checklist
feature/,bugfix/, orhotfix/+ 5–30 lowercase chars.env/example.envupdated if new environment variables were added (no new variables; the keys already exist in the committedapi/production.env)npm test) (not run; no tests cover these scripts)README.md/ docs updated if behaviour changed👀 Reviewer Notes
index.jsnow containsMANIFEST_ENCRYPT_KEYandMANIFEST_ENCRYPT_SALT. The same values were already committed inbuild.shandapi/production.env, so this exposes nothing new, and both files are allowlisted in.talismanrc. With publicly known values, though, the encryption only hides the SSO credentials inapp.json. A proper fix (a random key and salt per install, read bybuild.shfromproduction.env) is a separate follow-up.migration-*package build now stopsnpm run build. The old loop only failed if the last package failed.production.env; extra keys and comments; Windows line endings; duplicate keys; running it twice. On the committedproduction.envthe output is identical except for a trailing newline.package.json, runs each build in its own folder, and stops with the right exit code when one fails.upload-apicurrently crashes before checking any file (it looks like the rootajv >=8.18.0override breaks ESLint's config loader). That problem exists without this PR, so the new script isn't linted.