Skip to content
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

Use tarfile filters (PEP 706) when extracting sdists? #633

Closed
encukou opened this issue Jul 3, 2023 · 2 comments
Closed

Use tarfile filters (PEP 706) when extracting sdists? #633

encukou opened this issue Jul 3, 2023 · 2 comments

Comments

@encukou
Copy link

encukou commented Jul 3, 2023

Hello,
New security releases of Python add a filter argument to TarFile.extractall, which allows filtering common security issues.
I assume the the security issues are moot here, since build executes unpacked code right after the extractall.
Python 3.12 will raise a DeprecationWarning if filter is not specified. I assume build will at least want to avoid the warning.
Python 3.14 will change the default to tarfile.data_filter.

What are your thoughts on how to best handle this? Happy to send a PR after a discussion.

Possible solutions I see:

  • Use data_filter on Pythons that support it. Accept that the behaviour will change from previous versions.
  • Use data_filter if available, but only to raise exceptions (files/links outside target, device files), use existing mechanism if the filter doesn't fail. (There's another choice: abort the operation, or merely skip “bad” files?)
  • Use the fully_trusted filter to silence warnings and preserve existing behaviour.

See this issue in pip: pypa/pip#12111

Does this need a PEP?

@layday
Copy link
Member

layday commented Jul 3, 2023

Feel free to provide feedback on #609.

@encukou
Copy link
Author

encukou commented Jul 3, 2023

Ah, my apologies, I missed the PR!

@encukou encukou closed this as completed Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants