Repository navigation
🐛 fix(discovery): skip PATH for relative path specs - #287
Merged
gaborbernat merged 2 commits intoNov 30, 2026
Merged
Conversation
A relative path spec such as ../venv/bin/python that is missing from the working directory was joined to every PATH entry and probed there. The ".." segments carried the join out of PATH, so a file planted in a writable directory outside PATH ran with the caller's privileges during the search. The result was never selected, but it had already run. The return meant to stop the search for path specs only covered absolute paths, which are handled earlier, so it never fired for a relative one. Stop after the explicit candidates for any spec with a directory component. Bare names still search PATH and uv installs. Reported by oss-scanner as ANT-2026-NS23L1D8.
try_first_with paths are still probed for a relative path spec, so the entry now states only what stopped: the PATH join and the uv search.
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.
Asking for an interpreter by a relative path made discovery also try that path below every
PATHfolder and start whatever it found, before rejecting it. The path's..parts could reach a program outside the project andPATH, placed by another local user, and run it with the caller's permissions. 🔒 A path is now looked up only where it points, asshutil.whichand POSIXexecvptreat a name with a slash. This addresses draft advisory ANT-2026-NS23L1D8.tools/venv/bin/pythonstands in for a program another user placed; it only records that it was started:Before:
After:
#207 split requests into bare names, which search
PATH, and paths, which do not, for the working-directory lookup. ThePATHand uv-managed searches now follow the same split, which the documentation already promised.Requests by version, bare name or absolute path search as before. A relative path returns the same interpreter as before, and discovery starts fewer processes on the way.
Reported by oss-scanner: ANT-2026-NS23L1D8.