Repository navigation
🐛 fix(discovery): skip relative PATH entries - #235
Merged
gaborbernat merged 2 commits intoNov 3, 2026
Merged
Conversation
When a Windows caller omits PATH, the default search path starts with the working directory. A planted interpreter can run during discovery. Search absolute directories only, including when PATH is supplied explicitly.
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.
get_paths()accepted relative search directories, which could cause interpreter discovery to run a candidate from the working directory. On Windows, that directory could enter the search even when the caller omittedPATHfrom its supplied environment. The fix searches only absolute directories. This addresses draft advisory ANT-2026-YKKUJR8L.Windows default search path
When the supplied environment has no
PATH,get_paths()usesos.defpath. CPython's Windows default begins with., and the old loop accepted it as a search directory. The updated loop rejects relative entries before inspecting their contents.Caller-supplied PATH
The old loop also accepted nonempty relative entries in an explicit
PATH. Such entries could resolve below the working directory. The absolute-directory check applies to both explicit and default paths.Behavior changes
Relative
PATHentries, including., are ignored on all platforms. Callers who intend to select an interpreter in the working directory can pass a relative executable spec such as./pythonon POSIX or./python.exeon Windows. An environment mapping withoutPATHcan now yield no PATH candidates on Windows when its remaining default directory is absent. Other discovery sources remain available. Closes #202.Reported by Anthropic's OSS Scanner:
ANT-2026-YKKUJR8L.