Skip to content

Fully implement PEP 706: Change default filter for TarFile.extract() and extractall() to 'data' #121999

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

Closed
7 tasks done
WilliamRoyNelson opened this issue Jul 19, 2024 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@WilliamRoyNelson
Copy link
Contributor

WilliamRoyNelson commented Jul 19, 2024

Feature or enhancement

Proposal:

The documentation for tarfile discusses changes to the default behavior in 3.14 as a future change, but now that 3.14 is in development this change should be implemented and references to the change should reflect that the default behavior is now implemented.

  • Change default behavior in tarfile.py
  • Remove deprecation warning when using None
  • Update tests to reflect new default behavior
  • Update tarfile documentation to reflect that the change has been implemented
  • Update shutil
  • Update shutil tests
  • Add test to ensure default filter is set to 'data'

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

https://peps.python.org/pep-0706/#defaults-and-their-configuration

If both the argument and attribute are None:

  • In Python 3.12-3.13, a DeprecationWarning will be emitted and extraction will use the 'fully_trusted' filter.
  • In Python 3.14+, it will use the 'data' filter.

https://docs.python.org/3.14/library/tarfile.html#extraction-filters

None (default): Use TarFile.extraction_filter.

If that is also None (the default), raise a DeprecationWarning, and fall back to the 'fully_trusted' filter, whose dangerous behavior matches previous versions of Python.

In Python 3.14, the 'data' filter will become the default instead. It’s possible to switch earlier; see TarFile.extraction_filter.

Linked PRs

@WilliamRoyNelson WilliamRoyNelson added the type-feature A feature request or enhancement label Jul 19, 2024
WilliamRoyNelson added a commit to WilliamRoyNelson/cpython that referenced this issue Jul 19, 2024
WilliamRoyNelson added a commit to WilliamRoyNelson/cpython that referenced this issue Jul 19, 2024
WilliamRoyNelson added a commit to WilliamRoyNelson/cpython that referenced this issue Jul 19, 2024
encukou added a commit that referenced this issue Jul 26, 2024
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Scott Odle <scott@sjodle.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
@encukou encukou closed this as completed Jul 26, 2024
@encukou encukou marked this as a duplicate of #118875 May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants