CVE-2026-31245: Path Traversal Via Unchecked Path Join

The application relies on `path.join` or `path.resolve` to construct paths using input parameters without verifying that the resolved path stays within the intended base directory. This can cause path traversal vulnerabilities. Validate the resolved path against the expected base directory using `startsWith()` before accessing the file.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0JS
greprules fetch cve-2026-31245-path-traversal-via-unchecked-path-join --engine opengrep

Description

The application relies on `path.join` or `path.resolve` to construct paths using input parameters without verifying that the resolved path stays within the intended base directory. This can cause path traversal vulnerabilities. Validate the resolved path against the expected base directory using `startsWith()` before accessing the file.