Skip to content

gh-160097: Reject links replacing the destination in tarfile.tar_filter - #160098

Open
StanFromIreland wants to merge 3 commits into
python:mainfrom
StanFromIreland:tarfile-tar-filt-fix
Open

StanFromIreland wants to merge 3 commits into
python:mainfrom
StanFromIreland:tarfile-tar-filt-fix

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

@read-the-docs-community

read-the-docs-community Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35307573 | 📁 Comparing 4090063 against main (4869640)

  🔍 Preview build  

2 files changed
± library/tarfile.html
± whatsnew/changelog.html

Comment thread Lib/tarfile.py
# would replace it with a (sym)link, redirecting the destination
# for all subsequent members.
if ((member.islnk() or member.issym())
and os.path.normpath(name) == os.curdir):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The old check compared the member's real path against the real path of the destination directory, this was incorrect. For example, a link named x was rejected whenever an earlier x -> . symlink existed, even though extracting it only replaces that symlink (and never touches the destination directory).

CC @gps-head

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.

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

Labels

awaiting core review needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants