CVE-2026-8795: Go Partial Path Traversal Hasprefix

Checking path containment via `strings.HasPrefix` after `filepath.Join` is vulnerable to partial path traversal (Zip Slip variant). `filepath.Join` cleans the path and removes any trailing path separator. Validation using `strings.HasPrefix` can therefore be bypassed by paths that traverse out and into a sibling directory sharing the exact same string prefix

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Go
greprules fetch cve-2026-8795-go-partial-path-traversal-hasprefix --engine opengrep

Description

Checking path containment via `strings.HasPrefix` after `filepath.Join` is vulnerable to partial path traversal (Zip Slip variant). `filepath.Join` cleans the path and removes any trailing path separator. Validation using `strings.HasPrefix` can therefore be bypassed by paths that traverse out and into a sibling directory sharing the exact same string prefix