Repository navigation
🐛 fix(uv): limit home lookup to supplied env - #236
Merged
Merged
Conversation
An explicit environment mapping must bound interpreter discovery. The process-home fallback could probe and execute a uv-managed interpreter outside that mapping. Use mapped home and data-directory values for default uv roots. Correct the Windows order test to plant an interpreter in the Windows uv store. Fixes tox-dev#200.
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 a caller supplied an environment mapping without
HOMEorUSERPROFILE, uv store discovery substituted~and expanded it from the process environment. Discovery could then execute a candidate in that process home even though the caller's mapping did not name the directory. Default uv roots now come only from the supplied mapping. This addresses draft advisory ANT-2026-XQVCZ8E5.The home fallback escaped the mapping
Path.expanduser()resolves~to the process user's home. The old fallback used it when the mapping lacked a home variable, then probed executables under the resulting uv roots. The new selection skips home-derived roots when the mapping has no home variable.flowchart LR M[Mapped home absent] --> O[Old: expand process home] O --> P[Probe process-home uv store] M --> N[New: skip home-derived roots] M --> D[Mapped data directory present] D --> R[Probe mapped uv store] classDef old fill:#ffd6d6,stroke:#c1121f,color:#5c0000; classDef fixed fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332; class O,P old; class N,D,R fixed;Platform directory selection
uv uses platform data directories for managed Python installs. Windows still accepts an absolute mapped
APPDATA; macOS and Linux still accept an absolute mappedXDG_DATA_HOME. The Windows profile default requires mappedUSERPROFILE; Unix home defaults require mappedHOME. The platform branches use those values.Behavior changes
An explicit mapping with only
PATHno longer searches the process home for uv-managed interpreters. Calls that omitenvstill use the process environment as their mapping. An explicitUV_PYTHON_INSTALL_DIRstill selects its own root. Fixes #200.Reported by Anthropic's OSS Scanner: ANT-2026-XQVCZ8E5.