Skip to content

🐛 fix(discovery): skip relative PATH entries - #235

Merged
gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:security/ykkujr8l-path-entry
Nov 3, 2026
Merged

gaborbernat merged 2 commits into
tox-dev:mainfrom
gaborbernat:security/ykkujr8l-path-entry

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

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 omitted PATH from 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() uses os.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 PATH entries, 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 ./python on POSIX or ./python.exe on Windows. An environment mapping without PATH can 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.

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.
@gaborbernat gaborbernat added bug Something isn't working security Security fixes and advisories labels Nov 3, 2026
@gaborbernat
gaborbernat merged commit 2ab6e7a into tox-dev:main Nov 3, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security Security fixes and advisories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relative PATH entries search the working directory

1 participant