Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/sandbox-agent-writes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"kilo-code": minor
---

Confine agent shell and file-tool writes to project and Kilo state directories with the optional macOS sandbox.
Confine agent shell and file-tool writes to project and Kilo state directories with the optional macOS and Linux sandboxes.
14 changes: 14 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ jobs:

- uses: ./.github/actions/setup-bun

- name: Setup Zig for Linux sandbox helpers
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
with:
version: 0.14.0
use-cache: false

- name: Build
id: build
run: |
Expand Down Expand Up @@ -179,6 +185,13 @@ jobs:
smoke_host() {
binary="$1"
"$binary" --version
helper="$(dirname "$binary")/bwrap"
if [[ "${{ matrix.target }}" == linux-* ]]; then
test -x "$helper"
"$helper" --version
"$helper" --unshare-user --disable-userns --unshare-pid --die-with-parent --new-session \
--ro-bind / / --dev /dev --proc /proc -- "$helper" --version
fi
root="$(mktemp -d)"
trap 'rm -rf "$root"' RETURN
(
Expand Down Expand Up @@ -214,6 +227,7 @@ jobs:
# kilocode_change end
binary="/dist/$PACKAGE/bin/kilo"
"$binary" --version
"/dist/$PACKAGE/bin/bwrap" --version
root="$(mktemp -d)"
trap '\''rm -rf "$root"'\'' EXIT
unset KILO_MODELS_PATH KILO_MODELS_URL KILO_CONFIG KILO_CONFIG_DIR
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ jobs:
- name: Setup Bun
uses: ./.github/actions/setup-bun

- name: Setup Zig for Linux sandbox helper
if: runner.os == 'Linux'
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
with:
version: 0.14.0
use-cache: false

- name: Build Linux sandbox helper
if: runner.os == 'Linux'
run: |
bun packages/opencode/script/kilocode/bubblewrap.ts --arch x64 --output "$RUNNER_TEMP/bwrap"
echo "KILO_BWRAP_PATH=$RUNNER_TEMP/bwrap" >> "$GITHUB_ENV"

- name: Configure git identity
run: |
git config --global user.email "kilo-maintainer[bot]@users.noreply.github.com"
Expand All @@ -83,6 +96,12 @@ jobs:
KILO_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
KILO_TEST_PROFILE: ${{ runner.os == 'macOS' && github.event_name == 'pull_request' && 'darwin' || '' }} # kilocode_change

- name: Test nested mount rejection
if: runner.os == 'Linux'
run: |
sudo env PATH="$PATH" KILO_BWRAP_PATH="$KILO_BWRAP_PATH" KILO_TEST_PRIVILEGED_MOUNTS=1 \
"$(command -v bun)" test packages/core/test/kilocode/linux-sandbox.test.ts -t "nested mount"

- name: Run HttpApi exerciser gates
if: runner.os == 'Linux' # kilocode_change
working-directory: packages/opencode
Expand Down
5 changes: 4 additions & 1 deletion nix/kilo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
stdenvNoCC,
callPackage,
bun,
bubblewrap,
nodejs,
sysctl,
makeBinaryWrapper,
Expand Down Expand Up @@ -39,6 +40,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {

env.MODELS_DEV_API_JSON = "${models-dev}/dist/_api.json";
env.KILO_DISABLE_MODELS_FETCH = true;
env.KILO_SKIP_BUNDLED_BWRAP = "1";
env.KILO_VERSION = finalAttrs.version;
env.KILO_CHANNEL = "local";

Expand All @@ -59,6 +61,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
install -Dm644 schema.json $out/share/kilo/schema.json

wrapProgram $out/bin/kilo \
${lib.optionalString stdenvNoCC.hostPlatform.isLinux "--set KILO_BWRAP_PATH ${bubblewrap}/bin/bwrap"} \
--prefix PATH : ${
lib.makeBinPath (
[
Expand Down Expand Up @@ -97,7 +100,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
meta = {
description = "AI-powered development tool";
homepage = "https://kilo.ai/";
license = lib.licenses.mit;
license = [ lib.licenses.mit ] ++ lib.optional stdenvNoCC.hostPlatform.isLinux lib.licenses.lgpl2Plus;
mainProgram = "kilo";
inherit (node_modules.meta) platforms;
};
Expand Down
Loading
Loading