Repository navigation
🐛 fix(create): respect umask for copied Python - #3641
Merged
Merged
Conversation
Interpreter copies already get execute bits through the copy operation, filtered by the current umask. A later chmod restored bits the umask had removed, allowing another local account to run copies in a traversable environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
--copies, the builtin creator previously calledmake_exe()after copying each interpreter and alias. That changed a copy made under umask077from0700to0711in a traversable reused environment, where another local account could execute it. The copy now retains its creation mode. This addresses draft advisory ANT-2026-MKJR7DE8.A later chmod restored masked execute bits
copy()requests mode0755for an executable source. Python'sos.open()documentation says the current umask filters that mode at creation. The subsequentmake_exe()call usedchmod()to add execute bits after creation. The updated reference path leaves the copy's mode in place for both the base name and aliases.sequenceDiagram participant R as ExePathRefToDest.run participant C as copy participant D as Destination file participant M as make_exe R->>+C: copy executable source C->>+D: create with mode filtered by umask D-->>-C: initial mode C-->>-R: copy complete rect rgb(255, 214, 214) R->>+M: before: mark copy executable M->>D: chmod adds execute bits M-->>-R: mode widened end rect rgb(216, 243, 220) R-->>R: now: keep creation mode endBehavior changes
On POSIX, a copied executable source and its aliases retain the mode allowed by the umask:
0755under022,0750under027,0700under077, and0744under011. A source with no execute bits is no longer made executable by this copy path. Symlink creation and the publicmake_exe()helper are unchanged; this change adds no new errors. The shared wheel image permission path is separate.Reported by oss-scanner:
ANT-2026-MKJR7DE8.