Forbid tarballs with hard links being uploaded #1448
Merged
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.
It was discovered recently that tarballs with hard links aren't properly handled
in the
tar
crate and can in malicious situations cause any file on thefilesystem to get overwritten during the extraction process. This commit is a
patch for crates.io to simply reject all tarballs which have hard links inside
of them. This is a big hammer of a solution and is step 1 of a fix for this bug.
I've verified that all existing tarballs on crates.io do not contain hard links
and Cargo itself doesn't produce tarballs with hard links inside them. That
means that no legitimate tarball should be rejected as a result of this patch.
After this has been deployed I'll be updating the
tar
crate as well as Cargoitself, in addition to posting an announcement.