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

Ensure tar_info extraction filter compatibility in runtime archives #23

Closed
ncoghlan opened this issue Oct 18, 2024 · 0 comments · Fixed by #44
Closed

Ensure tar_info extraction filter compatibility in runtime archives #23

ncoghlan opened this issue Oct 18, 2024 · 0 comments · Fixed by #44
Assignees
Labels
Category: Bug Something isn't working

Comments

@ncoghlan
Copy link
Collaborator

ncoghlan commented Oct 18, 2024

The python-build-standalone CPython runtime tarballs are currently being unpacked in "fully trusted" mode (the tarfile module's default in Python 3.13 and earlier).

To avoid a Python 3.14 compatibility issue (where the default is changing to data_filter mode), I attempted to enable the tar_filter mode which prevents the potential security issues with fully trusted tarballs, but still allows full use of various tarfile features that are needed when shipping a CPython runtime archive.

This change revealed that the python-build-standalone archives are enabling group write permissions on many of the files in the runtime bundles (astral-sh/python-build-standalone#349), so enabling tar_filter means changing the expected hashes of the CPython runtimes (since it clears those group write permission flags).

To avoid introducing a discrepancy between Python 3.12+ and Python 3.11 (which doesn't support tar extraction filters), the change to clear the group and world write permissions on files in published archives also needs to be enforced by venvstacks itself (so even if the runtime files get unpacked into the build folder with 0o664 permissions, they'll still be set to 0o644 in the layer archive)

@ncoghlan ncoghlan added the Category: Bug Something isn't working label Oct 20, 2024
@ncoghlan ncoghlan self-assigned this Oct 23, 2024
@ncoghlan ncoghlan changed the title Ensure tar_info extraction filter compatibility in layer archives Ensure tar_info extraction filter compatibility in runtime archives Oct 24, 2024
ncoghlan added a commit that referenced this issue Oct 24, 2024
Also correctly marks some `pack_venv` APIs as private.

Closes #23
ncoghlan added a commit that referenced this issue Oct 24, 2024
Also correctly marks some `pack_venv` APIs as private.

Closes #23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant