Skip to content

fix(import): remap asset and entry UIDs containing regex metacharacters - #357

Open
naman-contentstack wants to merge 1 commit into
developmentfrom
fix/DX-10256
Open

fix(import): remap asset and entry UIDs containing regex metacharacters#357
naman-contentstack wants to merge 1 commit into
developmentfrom
fix/DX-10256

Conversation

@naman-contentstack

Copy link
Copy Markdown
Contributor

The asset UID swap in lookupAssets regex-escaped the UID and then handed it to String.split, which matches literally. A UID holding a regex metacharacter never matched the serialized entry, so the source UID survived the swap and the CMA rejected the entry with "Asset(s) does not exists" - a message that points at the export rather than at the failed rewrite. Escaping now matches the encoding the search actually runs against (JSON), so UIDs with a backslash or a quote work as well, and a swap that changes nothing is recorded as unmatched rather than matched, which keeps a silent failure out of matched-asset-uids.json.

updateUids carried the same escape-then-literal-split mismatch for entry UIDs in HTML RTE. It now builds a single alternation from every matching UID, longest first, so a UID that is a prefix of another cannot clobber it and a replacement value cannot be re-scanned by a later pass.

The asset UID swap in lookupAssets regex-escaped the UID and then handed
it to String.split, which matches literally. A UID holding a regex
metacharacter never matched the serialized entry, so the source UID
survived the swap and the CMA rejected the entry with "Asset(s) does not
exists" - a message that points at the export rather than at the failed
rewrite. Escaping now matches the encoding the search actually runs
against (JSON), so UIDs with a backslash or a quote work as well, and a
swap that changes nothing is recorded as unmatched rather than matched,
which keeps a silent failure out of matched-asset-uids.json.

updateUids carried the same escape-then-literal-split mismatch for entry
UIDs in HTML RTE. It now builds a single alternation from every matching
UID, longest first, so a UID that is a prefix of another cannot clobber
it and a replacement value cannot be re-scanned by a later pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@naman-contentstack naman-contentstack self-assigned this Aug 20, 2026
@naman-contentstack
naman-contentstack requested a review from a team as a code owner August 20, 2026 12:26
@snyk-io

snyk-io Bot commented Aug 20, 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

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 0 10 ✅ Passed
🟠 High Severity 0 0 25 ✅ Passed
🟡 Medium Severity 0 0 500 ✅ Passed
🔵 Low Severity 0 0 1000 ✅ Passed

⏱️ SLA Breach Summary

✅ No SLA breaches detected. All vulnerabilities are within acceptable time thresholds.

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

✅ BUILD PASSED - All security checks passed

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.

1 participant