Repository navigation
🐛 fix(app-data): protect missing cache parents - #3642
Merged
gaborbernat merged 2 commits intoNov 20, 2026
Merged
Conversation
Default app-data creation made only the cache leaf private. A loose umask could leave its parent writable by another local account. Create missing ancestors with owner-only permissions during default cache creation and migration. Existing paths and setgid shared caches retain their modes.
gaborbernat
added a commit
that referenced
this pull request
Nov 20, 2026
Complete the cache creation fix from #3642.
This was referenced Nov 20, 2026
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.
The default app-data creation path made the cache leaf private but could create its missing parent with permissions from a permissive umask. Another local account with write access to that parent could replace the cache entry and affect later pip seeding. The default path now creates every missing component with owner-only permissions. This addresses draft advisory ANT-2026-QZDZJBPR.
Default cache creation used the umask for parents
The old
os.makedirs(..., mode=0o700)call set the leaf mode, while Python applies the process umask to intermediate directories. The new creation path usesmake_private_dirs()for the default cache. It creates each missing component with mode0700and leaves existing components untouched.Migration could create an open target parent
The old migration paths could create a missing target parent through
shutil.move()oros.makedirs(). Nonnested migration now prepares that parent before moving or copying data. The migration target path now closes missing nested components too, unless the old cache has the setgid bit for intentional sharing. Migration markers, retry behavior, and config retention still use their existing paths.Behavior changes
On POSIX, each missing default-cache ancestor is created with mode
0700, including under umask002or000. On Windows, Python 3.12.4 and later apply owner-only access control foros.mkdir(..., 0o700); earlier supported runtimes ignore the mode, as they did for the cache leaf. An existing directory keeps its mode. Explicit--app-datapaths retain their umask-based creation behavior. Migration from a setgid shared cache retains group access. If a new path component becomes a file during creation, or an unavailable filesystem root stops the walk, the default cache falls back to temporary app-data.Reported by oss-scanner: ANT-2026-QZDZJBPR.