Skip to content

Validate gem name before building compact index cache paths#9717

Open
hsbt wants to merge 1 commit into
masterfrom
claude/sleepy-jepsen-c51c25
Open

Validate gem name before building compact index cache paths#9717
hsbt wants to merge 1 commit into
masterfrom
claude/sleepy-jepsen-c51c25

Conversation

@hsbt

@hsbt hsbt commented Jul 23, 2026

Copy link
Copy Markdown
Member

Bundler::CompactIndexClient::Cache builds info cache paths by joining the gem name into the cache directory. The name comes from the remote index, either versions lines or transitive dependency names in info files, and is never validated, so a name like ../../../../pwn escapes the cache directory because the special-characters branch keeps the raw name and only appends an MD5 suffix. info_etag_path embeds the raw name the same way. This rejects any name that is not a plain basename before constructing the path, matching the fetch_spec guard from 56ed326, and applies the same guard to the independent Gem::CompactIndexClient::Cache port. Existing cache files keep their names, so no cache is invalidated.

Bundler::CompactIndexClient::Cache#info_path and #info_etag_path join
the gem name into the cache directory without validation. The name comes
from the remote index, either versions lines or transitive dependency
names in info files, so a crafted name like "../../../../pwn" escapes
the cache directory because the special-characters branch keeps the raw
name and only appends an MD5 suffix. Reject any name that is not a plain
basename before constructing the path, matching the fetch_spec guard
from 56ed326, and apply the same guard to the independent
Gem::CompactIndexClient::Cache port.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 23, 2026 02:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants