kilocode icon indicating copy to clipboard operation
kilocode copied to clipboard

Sandbox .git deny blocks uv cache inside explicitly writable path

Open llyang opened this issue 1 month ago • 3 comments

Description

The sandbox blocks uv from using its cache even when the cache directory is explicitly included in sandbox.writable_paths.

uv uses a file named .git under its cache directory, for example:

~/.cache/uv/sdists-v9/.git

This is a cache marker used by uv; it is not Git repository metadata.

Kilo currently applies a global denyNames: [".git"] rule to sandbox writes. As a result, any file or directory named .git is denied, including .git files inside explicitly writable paths.

This means that the following configuration does not allow uv to use its cache as expected:

{
  "sandbox": {
    "enabled": true,
    "network": "allow",
    "writable_paths": [
      "~/.cache/uv"
    ]
  }
}

The expected behavior is that real Git metadata remains protected, while ordinary files named .git inside an explicitly writable path follow the normal writable_paths policy.

This is distinct from generic sandbox escalation or denial-detection issues such as #11547 and #13398. The sandbox itself is working; the issue is specifically that the global .git basename deny is broader than the Git-metadata protection it is intended to provide.

Plugins

No response

Kilo version

No response

Steps to reproduce

  1. Install uv and Kilo CLI.

  2. Add the following to the global Kilo configuration:

{
  "sandbox": {
    "enabled": true,
    "network": "allow",
    "writable_paths": [
      "~/.cache/uv"
    ]
  }
}
  1. From any project directory, start Kilo with sandboxing enabled, and ask it to create a Python environment using uv.

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

llyang avatar Oct 06 '26 12:10 llyang

Confirmed. denyNames: [".git"] (policy.ts) is enforced by name in the seatbelt, bubblewrap and in-process checks, so it also matches uv's .git marker (~/.cache/uv/sdists-v9/.git) under an explicit writable_paths entry. The docs (sandboxing.md) and policy.test.ts say .git is always read-only, so this is a policy decision rather than a plain bug.

Options:

  1. An opt-out such as sandbox.git_allowed_paths: ["~/.cache/uv"], where listed paths skip the .git name deny and the project's own .git stays protected. This is the smallest change, and the guarantee holds everywhere else.
  2. Deny only real git metadata (a .git directory with HEAD/objects/refs, or a gitdir: file). This is more automatic, but it still blocks .git directories in uv's cached git checkouts and needs a classifier in kilo-sandbox.

I'd suggest option 1. Which would you prefer?

Beehtrix avatar Nov 16 '26 23:11 Beehtrix

Thank you. I think option 1 is good enough for my purpose.

llyang avatar Nov 17 '26 03:11 llyang

Thanks, @llyang. @maintainers: the reporter is fine with option 1 (a sandbox.git_allowed_paths opt-out; the project's own .git stays read-only). Since it relaxes a documented sandbox guarantee and adds a config key, which per AGENTS.md also needs the cloud config.json schema entry, I'd like a go-ahead before opening a PR. Happy to implement it once confirmed.

Beehtrix avatar Nov 17 '26 05:11 Beehtrix