Repository navigation
mldistwatch: forbid tarbombs from being indexed - #392
Merged
Merged
Conversation
|
Does this handle a tarball with a top level '.' directory properly? |
Collaborator
Author
|
No! (concluded by thinking about it, not testing) |
Owner
|
@rjbs, could you review and resolve conflicts? |
rjbs
marked this pull request as draft
April 30, 2023 07:52
rjbs
added a commit
to rjbs/pause
that referenced
this pull request
Oct 24, 2026
An archive holding a single file, like Foo.pm, had one "root" and so passed the multiple-root check. It was only rejected later, for lacking META. Now a single top-level entry must be a directory. The error's wording now covers both cases: it no longer says "multiple roots", and it lists the "top-level entries" instead of the "directory entries". This is the case the original version of PR andk#392 tested with its Tarbomb-0.001 corpus file. Master had since come to handle its other cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rjbs
marked this pull request as ready for review
October 24, 2026 17:59
Archives are extracted right into the indexer's work directory, so an entry for "./" (as produced by "tar -czf x.tar.gz ."), is an entry for the work directory itself. GNU tar applies the "." entry's mode and ownership to the real cwd. An upload with a "./" entry of mode 0644 left the indexer unable to chdir back into its work directory, and the resulting die ended the whole indexer run, not just that dist. (Ugh.) Running as root, as in production, the chdir would succeed, but the work directory would still keep the archive's mode for the rest of the run, which could stop the unprivileged version parser from reading the files of every later dist. --no-overwrite-dir tells tar to leave existing directories' metadata alone. Co-Authored-By: Claude <noreply@anthropic.com>
PAUSE already refused archives that don't unpack into a single directory, but it looked for META first, and it looks for META inside the expected top-level directory. So a tarbomb, with its files at the top level, was always reported as having no META file, even when one was right there. Checking the archive's layout first gets the author the real reason. Co-Authored-By: Claude <noreply@anthropic.com>
An archive holding a single file, like Foo.pm, had one "root" and so passed the multiple-root check. It was only rejected later, for lacking META. Now a single top-level entry must be a directory. The error's wording now covers both cases: it no longer says "multiple roots", and it lists the "top-level entries" instead of the "directory entries". This is the case the original version of PR andk#392 tested with its Tarbomb-0.001 corpus file. Master had since come to handle its other cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, you could upload a tarball with "Foo.pm" in the root and we would index that. From now on, dists must have a top-level directory, and only that one directory.