CVE-2026-22860: Ruby Path Traversal Prefix Bypass

Validating path inclusion via a string prefix match (`start_with?`) on an expanded path can cause a directory traversal vulnerability. Since directory names are not boundary-checked, a path like '/foo_bar' will match the prefix '/foo'. Ensure you append a trailing directory separator to the prefix before checking or use `==` for exact matches.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Ruby
greprules fetch cve-2026-22860-ruby-path-traversal-prefix-bypass --engine opengrep

Description

Validating path inclusion via a string prefix match (`start_with?`) on an expanded path can cause a directory traversal vulnerability. Since directory names are not boundary-checked, a path like '/foo_bar' will match the prefix '/foo'. Ensure you append a trailing directory separator to the prefix before checking or use `==` for exact matches.