Skip to content

Fix wheel file permissions being too restrictive - #806

Open
pctablet505 wants to merge 2 commits into
pypa:mainfrom
pctablet505:fix-wheel-permissions-804
Open

Fix wheel file permissions being too restrictive#806
pctablet505 wants to merge 2 commits into
pypa:mainfrom
pctablet505:fix-wheel-permissions-804

Conversation

@pctablet505

Copy link
Copy Markdown

Fixes #804

make_wheel_in() builds the wheel in a temporary file created by tempfile.mkstemp(), which sets the file's permissions to 0600. That mode was never relaxed before the temp file was renamed into its final .whl path, so built wheels ended up owner-only readable instead of the usual world-readable 0644. This breaks setups where the wheel is later read by a different user (e.g. some CI/build pipelines).

The fix normalizes the temp file's permissions with the existing normalize_file_permissions() helper right before it's renamed into place, matching the same normalization already applied to the entries inside the wheel. Added a regression test that checks the built wheel's mode on disk.

Same root cause as pypa/hatch#1519, fixed there with the analogous normalize_artifact_permissions().

@pctablet505
pctablet505 marked this pull request as ready for review July 17, 2026 12:26
make_wheel_in() builds the wheel in a temporary file created by
tempfile.mkstemp(), which sets permissions to 0600. This mode was
never relaxed before the file was renamed into place, so built wheels
ended up mode 0600 instead of a normal, world-readable 0644.

Normalize the temp file's permissions with the existing
normalize_file_permissions() helper before renaming it to the final
wheel path, matching how files inside the wheel are already
normalized.

Fixes pypa#804
Add a Version 4.0.1 heading with a release-notes bullet for the wheel
permissions fix, following the project's convention of giving each
bugfix a :ghpull: reference under its own version heading.
@pctablet505
pctablet505 force-pushed the fix-wheel-permissions-804 branch from 706e284 to 15bc930 Compare August 16, 2026 02:56
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

Successfully merging this pull request may close these issues.

Wheels are created with too strict permissions

1 participant