CVE-2026-41278: Path Traversal Unsafe Prefix Replace

Extracting a file path by summarily replacing a prefix string using `.replace()` before using it in a file operation leaves the application vulnerable to Path Traversal/Local File Inclusion. Replace this arbitrary removal step with proper path-sanitization logic like `path.basename()` or a dedicated sanitizer function.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0JS
greprules fetch cve-2026-41278-path-traversal-unsafe-prefix-replace --engine opengrep

Description

Extracting a file path by summarily replacing a prefix string using `.replace()` before using it in a file operation leaves the application vulnerable to Path Traversal/Local File Inclusion. Replace this arbitrary removal step with proper path-sanitization logic like `path.basename()` or a dedicated sanitizer function.