[3.13] gh-157190: Fix tarfile data/tar filter bypass via hard link to a symlink - #157192
Open
StanFromIreland wants to merge 3 commits into
Open
[3.13] gh-157190: Fix tarfile data/tar filter bypass via hard link to a symlink#157192StanFromIreland wants to merge 3 commits into
data/tar filter bypass via hard link to a symlink#157192StanFromIreland wants to merge 3 commits into
Conversation
(cherry picked from commit 480ea4a) Co-authored-by: Stan Ulbrych <stan@python.org>
maurycy
reviewed
Sep 8, 2026
| os.link(tarinfo._link_target, targetpath) | ||
| # Resolve the target so the hard link points to the file | ||
| # itself. Otherwise os.link() may duplicate a symlink to a | ||
| # shallower location, where it's relative target escapes the |
Contributor
There was a problem hiding this comment.
Suggested change
| # shallower location, where it's relative target escapes the | |
| # shallower location, where its relative target escapes the |
|
|
||
| @symlink_test | ||
| @os_helper.skip_unless_hardlink | ||
| def test_sneaky_hardlink_relocation(self): |
Contributor
There was a problem hiding this comment.
Do we need a test if the symlink points to a directory?
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.
(cherry picked from commit 480ea4a)
data/tarfilter bypass via hard link to a symlink #157190