Skip to content

builder: Reject .. in long paths past the 100-byte mark - #489

Open
darshan-mog wants to merge 1 commit into
composefs:mainfrom
darshan-mog:builder-long-path-dotdot
Open

darshan-mog wants to merge 1 commit into
composefs:mainfrom
darshan-mog:builder-long-path-dotdot

Conversation

@darshan-mog

Copy link
Copy Markdown

prepare_header_path only validates the first 100 bytes when it falls back to a GNU long name, so append_data accepts "c".repeat(100) + "/../../evil" and writes the .. into the archive even though a/../evil is refused; reject .. in the full path before emitting the long-name entry.

Header::set_path refuses `..` components, but once a path is 100
bytes or longer prepare_header_path falls back to a GNU long name
and only the truncated prefix stored in the header gets validated.
A `..` after that point was written into the long name unchecked,
so "c" * 100 + "/../../evil" was accepted while "a/../evil" was not.

Check the full path before emitting the long-name entry.

Assisted-by: AI

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant