Repository navigation
🐛 fix(unix): reject cwd runtime fallback - #744
Merged
gaborbernat merged 2 commits intoNov 20, 2026
Merged
Conversation
tempfile can select the working directory after the configured and standard temporary locations fail. A predictable runtime path there can pick up files from a checkout. Require a standard POSIX or absolute configured temporary root before using the fallback. Fixes tox-dev#743
Use current safe temporary roots when tempfile has cached a working directory or an old setting. Keep XDG runtime file searches usable when no temporary directory is available. Refs tox-dev#743
4 tasks done
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.
When no standard temporary directory is writable, Unix runtime fallback can use the current working directory. An application started in a checkout can then treat a preexisting
runtime-<uid>tree there as runtime storage. The fallback now selects an available standard or absolute configured temporary directory before returning a runtime path. Fixes #743.CPython tries the current directory last when selecting a temporary directory. Unix fallback selection checks that result against
/tmp,/var/tmp,/usr/tmp, and current absoluteTMPDIR,TEMP, orTMPsettings. If Python cached a working directory or an old setting, it tries the current candidates. Runtime file searches can still use a validXDG_RUNTIME_DIRwhen the temporary fallback is unavailable.When Python selects an unsafe directory and no safe candidate works, callers get
PermissionErrorasking them to setXDG_RUNTIME_DIR. If Python finds no temporary directory at all, itsFileNotFoundErrorpropagates. Existing runtime directories below an available standard or absolute configured location remain usable.Reported by OSS Scanner: ANT-2026-YBJMNEUE.