Repository navigation
🐛 fix(discovery): probe case in a private temp dir - #286
Merged
gaborbernat merged 2 commits intoNov 30, 2026
Merged
Conversation
The case probe lower-cased the whole absolute path of its temporary file, so the lookup left the probe's directory and landed on a name in the shared temp directory. Another local user could create that name and make discovery raise PermissionError, or cache a false case-insensitive answer. The probe now runs inside a TemporaryDirectory and lower-cases only the file name, so the lookup stays in a directory only the caller can write. Reported by oss-scanner as ANT-2026-B0M9PD96.
The test only checked which path Path.exists received, so it still passed with the result inverted. It now plants the lower-cased twin of the probe file in the shared temp directory and asserts the probe matches the host file system.
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.
On a shared machine, another user could make interpreter discovery fail for someone else, or skip an installed interpreter, by creating an entry in the shared temporary directory. Tools built on python-discovery, such as virtualenv and tox, then stopped with a
PermissionError. 🔒 Nothing another user creates there affects discovery any more. This addresses draft advisory ANT-2026-B0M9PD96.In a shared temporary directory, with
tmp.arff6yce5rstanding in for another account's folder (Python 3.9 to 3.13):Before:
After:
Discovery checks once per process whether the file system treats
Fooandfooas one name. The check now runs in a folderTemporaryDirectorycreates for the current user alone, so only the file system decides the answer.Which interpreters are found does not change on a normal machine. A machine with no writable temporary directory still fails as before.
Reported by oss-scanner: ANT-2026-B0M9PD96.