Skip to content

Commit db38bcf

Browse files
author
molty3000
committed
fix: sandbox — add -w /workspace to docker exec + make mount read-write
Bug 1: docker exec defaulted to / as working directory, but files are mounted at /workspace. Commands like 'ls' or 'cat go.mod' returned empty because the cwd was wrong. Fixed with -w /workspace. Bug 2: Volume was mounted read-only (:ro), preventing the agent from writing files, running builds, or creating test artifacts. Changed to read-write (:rw is default). The sandbox still provides strong isolation — no network, no capabilities, no privilege escalation, destroyed on exit.
1 parent 93e78f8 commit db38bcf

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cmd/kode/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ done:
119119
"--security-opt", "no-new-privileges", // no privilege escalation
120120
"--network", "none", // no network
121121
"--tmpfs", "/tmp:noexec", // no executable temp files
122-
"-v", wd+":/workspace:ro", // working dir read-only
122+
"-v", wd+":/workspace", // working dir (read-write inside sandbox)
123123
"alpine:latest",
124124
"sleep", "infinity",
125125
)

cmd/kode/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (t *shellTool) Call(args string) (string, error) {
4343

4444
var cmd *exec.Cmd
4545
if t.containerName != "" {
46-
cmd = exec.Command("docker", "exec", t.containerName, "sh", "-c", input.Command)
46+
cmd = exec.Command("docker", "exec", "-w", "/workspace", t.containerName, "sh", "-c", input.Command)
4747
} else {
4848
cmd = exec.Command("sh", "-c", input.Command)
4949
}

0 commit comments

Comments
 (0)