CVE-2026-35613: Path Traversal Prefix Confusion

A path boundary check was performed using `startsWith` without ensuring a trailing directory separator. An attacker could bypass the directory boundary if a sibling directory exists that shares the same string prefix as the base directory. To fix this, append a directory separator (e.g., `sep` or `/`) to the base directory before checking the prefix.

Provally CuratedPublic repositoryMediumHigh confidenceVerifiedApache-2.0JS
greprules fetch cve-2026-35613-path-traversal-prefix-confusion --engine opengrep

Description

A path boundary check was performed using `startsWith` without ensuring a trailing directory separator. An attacker could bypass the directory boundary if a sibling directory exists that shares the same string prefix as the base directory. To fix this, append a directory separator (e.g., `sep` or `/`) to the base directory before checking the prefix.