feat(cli): add Linux filesystem sandbox - #11596
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous Review Summaries (9 snapshots, latest commit ebb744c)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ebb744c)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 64c496c)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 3332e26)Status: 1 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Previous review (commit f16fd3d)Status: No Issues Found | Recommendation: Merge Files Reviewed (1 files)
Previous review (commit 35a7362)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 265a211)Status: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous review (commit 002cf96)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 2772ed0)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 209e7a7)Status: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Files Reviewed (20 files)
Reviewed by gpt-5.4-2026-03-05 · Input: 87.1K · Output: 16.2K · Cached: 459.3K Review guidance: REVIEW.md from base branch |
# Conflicts: # packages/kilo-sandbox/src/backend.ts # packages/kilo-sandbox/src/index.ts # packages/kilo-sandbox/test/backend.test.ts # packages/kilo-vscode/script/local-bin.ts # packages/kilo-vscode/src/services/cli-backend/cli-resources.ts # packages/kilo-vscode/tests/unit/server-manager-utils.test.ts # packages/opencode/script/postinstall.mjs # packages/opencode/script/publish.ts
Linux filesystem sandbox red-team resultsI completed a nine-phase adversarial test of the Linux Bubblewrap backend using the packaged Linux ARM64 VSIX in an Ubuntu VM. The test used only disposable canaries under a dedicated fixture. The sandbox was enabled through the normal extension control, and commands ran with the expected topology:
The test covered direct VFS writes, metadata changes, mmap, symlink escapes, concurrent symlink swapping, hard-link aliases, existing and future Behaviors that heldThe read-only root plus explicit writable project mount blocked the expected direct escape paths:
These results provide strong evidence that ordinary direct-path, symlink, procfs, namespace, descendant, and tested TOCTOU attacks are contained by the mount design. Confirmed hard-link alias breakoutA pre-existing hard link inside a writable project can refer to the same inode as a file reached through a protected read-only path. Linux read-only bind mounts protect the mounted path, not every other pathname for the underlying inode. Opening the inode through the writable project alias therefore mutates the data visible through the read-only path. Four prepared canaries demonstrated this:
For every pair, This is a direct write breakout, not only a pathname-policy discrepancy. It affects both spawned commands and guarded built-in writes. It requires the cross-boundary hard link to exist before the sandboxed operation starts. The sandbox could not create a new such link itself, and a normal Git clone does not preserve hard links. The condition can still be introduced by a manually prepared workspace, archive extraction or setup tooling that preserves links, or another unsandboxed process. Confirmed future
|
Linux filesystem sandbox red-team attack matrixThis table records the full nine-phase adversarial test run discussed in the preceding red-team conclusion. It applies to PR head Classification used below:
Final canary changesThe independent baseline comparison found these persistent changes:
|
…stem-sandbox feat(cli): add Linux filesystem sandbox
Linux currently has no process backend for the generic sandbox profile, so enabling the sandbox rejects every model-originated command even though built-in file tools are guarded. Requiring users to install and configure a separate sandbox would also make the feature unreliable across CLI and VS Code distributions.
This adds a Bubblewrap backend that compiles the existing profile into a read-only host view with explicit writable roots and narrower protected mounts. Existing protected names such as
.gitremain read-only at nested paths, symlink escapes resolve into the read-only view, nested mount points fail closed, descendants stay inside the PID and mount namespaces, and unavailable or blocked user namespaces continue to reject process launches rather than retrying unsandboxed.Network isolation for spawned Linux commands is explicitly excluded from this PR. The Bubblewrap backend does not add
--unshare-net, so the network restriction setting continues to guard classified in-process HTTP tools but does not yet block TCP or UDP traffic from Linux shell commands and their descendants. Linux process-network enforcement, capability probing, compatibility behavior, and integration coverage are tracked in #11651. Delegated authority through pathname Unix sockets is separate and tracked in #11650.Linux distributions now include a non-setuid static Bubblewrap sidecar with digest verification and corresponding license/source material. Kilo prefers a working trusted system executable when host policy authorizes it, then falls back to the bundled executable, so supported users do not need to install anything separately. Existing npm, archive, Docker, Nix, Homebrew, AUR, and VS Code packaging paths preserve the helper alongside the CLI.
Closes #11540
Part of #11538