Start opencode's sandbox on Pop!_OS; lint and the smoketest now pass
The first run of lint and the full Docker smoketest since the CoreDesktop ports found: - opencode's sandbox didn't start. Its profile didn't allow all Unix sockets, so srt added its socket filter, which needs a user namespace inside bubblewrap, and Pop!_OS' AppArmor (bwrap-userns-restrict) denies that. opencode now allows them and hides their paths (/run/user, /run/dbus, Docker, Podman, Tailscale, X11, tmux, ssh-agent), as Hermes and Cline Desktop do. 80-security shows it still can't reach the session D-Bus. - 80-security's agent list was named AGENTS, and 30-agents.sh, loaded later, replaced it with its own, so every sandbox check ran a command that doesn't exist. It's FAKE_AGENTS now. - 50-sandbox's "can't" checks would pass if the sandbox never started; a check that it starts now comes first. - shellcheck read a jq variable named done as bash's keyword (SC1010). TEST.md says to install shellcheck and Docker, which the connector doesn't. PLAN.md: pin srt, try the real opencode, and settle on 24.04 or 26.04. make lint passes. smoketest/run --tier all passed every scenario but 50 and 80 before the opencode change, and 50 and 80 pass after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,7 @@ PRIVILEGED=1
|
||||
# runs it exactly as it would run opencode, Hermes or Cline Desktop: same
|
||||
# config, same srt, same proxy.
|
||||
|
||||
AGENTS=(opencode hermes cline-desktop)
|
||||
FAKE_AGENTS=(opencode hermes cline-desktop)
|
||||
FAKE_BIN="$HOME/smoketest-agents"
|
||||
# Where opencode and Hermes are started; Cline Desktop always starts in ~/Projects
|
||||
PROJECT="$HOME/Projects/smoketest-project"
|
||||
@@ -84,7 +84,7 @@ outside() {
|
||||
blocked() {
|
||||
local agent
|
||||
check "outside the sandbox: $1" outside "$2"
|
||||
for agent in "${AGENTS[@]}"; do
|
||||
for agent in "${FAKE_AGENTS[@]}"; do
|
||||
check "$agent: $1" fails_in "$agent" "$2"
|
||||
done
|
||||
}
|
||||
@@ -105,7 +105,7 @@ write_stays_in() {
|
||||
write_blocked() {
|
||||
local agent
|
||||
check "outside the sandbox: $1" outside "[ -w \"\$(dirname $2)\" ] && { [ ! -e $2 ] || [ -w $2 ]; }"
|
||||
for agent in "${AGENTS[@]}"; do
|
||||
for agent in "${FAKE_AGENTS[@]}"; do
|
||||
check "$agent: $1" write_stays_in "$agent" "$2" "smoketest-escape-$agent"
|
||||
done
|
||||
}
|
||||
@@ -118,7 +118,7 @@ setup_sandbox() {
|
||||
|
||||
mkdir -p "$FAKE_BIN" "$PROJECT" "$HOME/smoketest-other" "$HOME/.local/bin" \
|
||||
"$HOME/.config/systemd/user" "$HOME/.config/autostart" "$(dirname "$USER_SANDBOX_CONF")"
|
||||
for agent in "${AGENTS[@]}"; do
|
||||
for agent in "${FAKE_AGENTS[@]}"; do
|
||||
printf '#!/bin/bash\nexec bash "$@"\n' > "$FAKE_BIN/$agent"
|
||||
chmod +x "$FAKE_BIN/$agent"
|
||||
done
|
||||
@@ -155,7 +155,7 @@ sandbox_checks() {
|
||||
step "The sandbox: what agents must be able to do, or the rest proves nothing"
|
||||
setup_sandbox
|
||||
lan="http://$LAN_IP"
|
||||
for agent in "${AGENTS[@]}"; do
|
||||
for agent in "${FAKE_AGENTS[@]}"; do
|
||||
check "$agent: writes in the folder it started in" works_in "$agent" 'echo x > ./smoketest-probe && rm ./smoketest-probe'
|
||||
check "$agent: writes in /tmp" works_in "$agent" 'echo x > /tmp/smoketest-probe-$$ && rm /tmp/smoketest-probe-$$'
|
||||
check "$agent: reaches an allowed domain through its proxy" works_in "$agent" 'curl -sf -o /dev/null -m 20 https://github.com/'
|
||||
@@ -197,7 +197,7 @@ sandbox_checks() {
|
||||
source "$CONNECTOR/configure.d/lib/json.sh"
|
||||
check "allow one LAN server, as configure ai-servers does" \
|
||||
edit_json "$USER_SANDBOX_CONF" '{}' --arg s "$LAN_IP:$LAN_PORT" '.network.allowedDomains += [$s]'
|
||||
for agent in "${AGENTS[@]}"; do
|
||||
for agent in "${FAKE_AGENTS[@]}"; do
|
||||
check "$agent: reaches the allowed LAN server" works_in "$agent" "curl -sf -m 10 $lan:$LAN_PORT/"
|
||||
done
|
||||
blocked "reaches another port on the allowed LAN server" "curl -sf -m 10 $lan:$LAN_PORT_OTHER/"
|
||||
|
||||
Reference in New Issue
Block a user