-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add exclusion patterns for tarfile-extractall-traversal #72
base: main
Are you sure you want to change the base?
Conversation
|
- pattern-not: | | ||
with tarfile.open(...) as $TAR: | ||
... | ||
$TAR.extractall(..., filter=$FILTER, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per https://docs.python.org/3/library/tarfile.html#default-named-filters we may still want to have failing behavior if filter is 'fully_trusted'
, or None
prior to 3.14, but at least this forces it to be explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree. I think we should still detect cases where filter
is set to "fully_trusted"
, "tar"
, or None
. Since the default will be "data"
in Python 3.14 I think that's a reasonable acknowledgment that even "tar"
has some security concerns. For example, it allows links to absolute paths or paths outside of the destination.
Thanks for the PR! To sum up, from python3.14 the default filter is
Another question: what happens if both filter and members args are provided:
|
My reading of members is that it simply filters some elements, so while it might be more deliberate than a blind extractall, it is not necessarily more safe. Compare with a single |
As per PEP706 the filter arg is used to prevent directory traversal