Skip to content

uv is found in the working directory through an empty or relative PATH entry #72

Open

Description

@morisil

https://github.com/xemantic/xemantic-kotlin-script-python/blob/7e3f623/src/main/kotlin/PythonDependencies.kt#L289-L293

findOnPath resolves every PATH entry with Path(it, name), so an empty entry (a leading/trailing : or ::, e.g. PATH=/usr/bin:) or . resolves to the JVM working directory — a uv executable planted there (e.g. among an agent's generated files) is then run as the installer of every dependency.

Reproduction: PATH=/usr/bin:, an executable ./uv in the JVM working directory, run a script with # /// script dependencies — the planted ./uv runs.

Possible fix: skip empty and relative PATH entries (as shells do not do, but ProcessBuilder-based lookups should for a security-sensitive tool), resolving only absolute directories.

The same threat as #24 and #45 (files in the working directory steering the installer), found during the review of the fix for #45 — pre-existing on main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions