Skip to content

fix: sanitize filename before processing in upload route#1100

Merged
umesh-more-cstk merged 2 commits into
devfrom
feature/cmg-705
Jun 23, 2026
Merged

fix: sanitize filename before processing in upload route#1100
umesh-more-cstk merged 2 commits into
devfrom
feature/cmg-705

Conversation

@aishwarya-cstk

@aishwarya-cstk aishwarya-cstk commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🔗 Jira Ticket

Replace with your ticket link — required before requesting review.

(https://contentstack.atlassian.net/browse/CMG-1015)


📋 PR Type

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

📝 Description

What changed?

  • Sanitized filenames before processing in the upload route.

  • Fixed file validation failures for filenames containing version numbers in parentheses (e.g., airport city (1).xml).

  • Updated upload validation logic to correctly handle versioned filenames during New Stack migrations.

Why?

In the New Stack v1.0.2 flow, file uploads were failing validation when the filename contained a version suffix in parentheses. This prevented valid migration files from being processed successfully. The filename sanitization ensures such files are handled correctly during validation and upload.


🧩 Affected Areas

  • api — Node.js backend
  • ui — React frontend
  • upload-api — Upload API server
  • docker / docker-compose
  • CI / GitHub Actions workflows
  • Environment variables / config
  • Other:

🧪 How to Test

  1. Navigate to the New Stack migration flow.
  2. Upload a migration file with a versioned filename, such as airport city (1).xml.
  3. Verify that the file passes validation and uploads successfully.
  4. Upload a file without a version suffix and verify existing behavior remains unchanged.

Expected result:

  • Files with version suffixes in their names should pass validation and upload successfully.
  • Existing file upload behavior should remain unaffected.

✅ Author Checklist

Complete this before moving the PR out of Draft.

  • 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 sensitive credentials or secrets committed
  • Existing tests pass locally (npm test)
  • New tests written (or not applicable — explain why)
  • README.md / docs updated if behaviour changed
  • Talisman pre-push scan passes (no secrets flagged)

👀 Reviewer Notes


Migration v2 · Docs · Issues

@aishwarya-cstk aishwarya-cstk requested a review from a team as a code owner June 22, 2026 13:16
@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 1 0 10 ✅ Passed
🟠 High Severity 14 341 25 ✅ Passed
🟡 Medium Severity 36 2 500 ✅ Passed
🔵 Low Severity 1 0 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 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 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: 0
  • High without fixes: 341
  • Medium without fixes: 2
  • Low without fixes: 0

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

Consider reviewing these vulnerabilities when fixes become available.

1 similar comment
@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 1 0 10 ✅ Passed
🟠 High Severity 14 341 25 ✅ Passed
🟡 Medium Severity 36 2 500 ✅ Passed
🔵 Low Severity 1 0 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 0 15 / 30 days ✅ Passed
🟠 High 0 0 30 / 120 days ✅ Passed
🟡 Medium 0 2 90 / 365 days ⚠️ Warning
🔵 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: 0
  • High without fixes: 341
  • Medium without fixes: 2
  • Low without fixes: 0

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

Consider reviewing these vulnerabilities when fixes become available.

@umesh-more-cstk umesh-more-cstk merged commit 8aa9696 into dev Jun 23, 2026
9 checks passed
@umesh-more-cstk umesh-more-cstk deleted the feature/cmg-705 branch June 23, 2026 05:40
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.

3 participants