Repository navigation
fix: refuse to write files outside the target directory during sdist extraction - #11027
Merged
Merged
Conversation
radoering
force-pushed
the
tar-extraction-fallback
branch
from
August 29, 2026 15:17
111c7fc to
695a5b5
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/poetry/utils/helpers.py" line_range="348" />
<code_context>
+ mode = None
+ else:
+ # Reject special files
+ raise ValueError(
+ "Refusing to extract special file {member.name}"
+ )
+ if mode != member.mode:
</code_context>
<issue_to_address>
**nitpick (bug_risk):** The special-file rejection error contains the literal text `{member.name}` because the string is not an f-string, so callers cannot identify which archive member caused extraction to fail.
**Triggers:** When an sdist contains a FIFO, device, or other unsupported special file.
**Suggested fix:** Prefix the string with `f` so the member name is interpolated.
```suggestion
f"Refusing to extract special file {member.name}"
```
</issue_to_address>Sourcery assessment
Needs a human reviewer. If the path and link validation is wrong, archive extraction could write or overwrite files outside the destination, and those changes would remain after reverting the code. A fully correct revert would stop future incidents but would not undo files already written; otherwise, overly strict filtering would cause ordinary extraction failures that can be fixed normally.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
mwalbeck
pushed a commit
to mwalbeck/docker-python-poetry
that referenced
this pull request
Sep 6, 2026
This PR contains the following updates: | Package | Update | Change | Pending | |---|---|---|---| | [poetry](https://github.com/python-poetry/poetry) ([changelog](https://python-poetry.org/history/)) | patch | `2.4.1` → `2.4.2` | `2.4.3` | --- ### Release Notes <details> <summary>python-poetry/poetry (poetry)</summary> ### [`v2.4.2`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#242---2026-08-29) [Compare Source](python-poetry/poetry@2.4.1...2.4.2) ##### Fixed - Fix an issue where Poetry installs an artifact that is not listed in the lockfile when the package source does not provide a hash for this artifact ([#​11030](python-poetry/poetry#11030)). - Fix a path traversal vulnerability when downloading files from a compromised URL and/or package source ([#​11029](python-poetry/poetry#11029)). - Fix a path traversal vulnerability in sdist extraction on Python 3.10.0-3.10.12 and 3.11.0-3.11.4 that could allow malicious tarball files to write files outside the target directory ([#​11027](python-poetry/poetry#11027)). </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNjAuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI2MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://git.walbeck.it/mwalbeck/docker-python-poetry/pulls/1760
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Pull Request Check List
Only relevant for outdated Python versions.