GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [3.10] gh-149486: tarfile.data_filter: validate written link target (GH-149487) by StanFromIreland · Pull Request #153180 · python/cpython

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Jul 6, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The data filter rewrote linknames with normpath() but ran the containment check against the un-normalised value, and computed a symlink's directory before stripping trailing slashes. Both let a crafted archive create links pointing outside the destination. Also reject link members that resolve to the destination directory itself, which could otherwise replace it with a symlink and redirect all subsequent members.

(Patch by Greg; Petr's just reviewing & merging.)
(cherry picked from commit 5784119)

  • Issue: tarfile.data_filter doesn't handle symlinks with empty names #149486

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@encukou @gpshead @StanFromIreland
[3.10] pythongh-149486: tarfile.data_filter: validate written link ta…
6fd7650
…rget (pythonGH-149487)

The data filter rewrote linknames with normpath() but ran the
containment check against the un-normalised value, and computed a
symlink's directory before stripping trailing slashes.  Both let a
crafted archive create links pointing outside the destination.  Also
reject link members that resolve to the destination directory itself,
which could otherwise replace it with a symlink and redirect all
subsequent members.

(Patch by Greg; Petr's just reviewing & merging.)
(cherry picked from commit 5784119)

Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Gregory P. Smith <[email protected]>
@StanFromIreland
StanFromIreland requested a review from ethanfurman as a code owner July 6, 2026 09:21
This was referenced Jul 6, 2026
tarfile.data_filter doesn't handle symlinks with empty names #149486
Closed
gh-149486: tarfile.data_filter: validate written link target #149487
Merged
@bedevere-app bedevere-app Bot added the awaiting core review label Jul 6, 2026
@StanFromIreland

StanFromIreland commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Based on #150904.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland assigned StanFromIreland and pablogsal and unassigned StanFromIreland Jul 6, 2026
@pablogsal
pablogsal merged commit c063191 into python:3.10 Jul 6, 2026
21 of 23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Jul 6, 2026
@StanFromIreland
StanFromIreland deleted the backport-5784119-3.10 branch July 6, 2026 19:56
icanhasmath pushed a commit to ActiveState/cpython that referenced this pull request Oct 28, 2026
@StanFromIreland @icanhasmath
[3.10] pythongh-149486: tarfile.data_filter: validate written link ta…
b6f6db1
…rget (pythonGH-149487) (python#153180)

(cherry picked from commit c063191)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ethanfurman ethanfurman Awaiting requested review from ethanfurman ethanfurman is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@pablogsal pablogsal

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@StanFromIreland @pablogsal @encukou
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.