Autonomous Loop Security|INEMA.CLUB-PRO

Lesson 6 · 20 min

Network and file sandbox

A rule and a hook read the command; the sandbox reads nothing: the operating system simply won't let the process write outside the folder or open the network. But a sandbox can also fail silently. In this lesson you prove, with four escape attempts, what holds on your machine, and you see two locks that did not hold on this one.

Start the lesson
Acrylic and steel laboratory glove box with a circuit board inside, on a dark workbench.

In this lesson you will

  1. 1Files and network: the two borders of the sandbox
  2. 2prova-isolamento.sh: four probes, one verdict
  3. 3Two locks that did not hold here: systemd --user and Claude without socat
  4. 4What the sandbox does not cover: reading outside the folder

Goal: prove on your machine that the sandbox blocks writes outside the folder and network access, instead of trusting the flag.

01Four escape attempts

Click each probe.

Click each block in the diagram to see what it does.

Secondary-source report: Help Net Security records sandbox and allowlist failing in 2026 in Cursor and Codex CLI. The practical conclusion is to prove the lock, not to ask for more confirmation.

02Rehearsal: the same proof with four locks

No lock, the Codex sandbox in the :read-only and :workspace profiles, and systemd-run with PrivateNetwork and ProtectHome. No model.

Terminal · four locks
P=~/projetos/loop-r-eng-seguranca-v72/kit/prova-isolamento.sh
W=/tmp/ensaio-seg/iso; mkdir -p $W
echo "## sem trava"; bash $P; echo "saída: $?"
echo "## codex sandbox :read-only"; bash $P codex sandbox -P :read-only -C $W --; echo "saída: $?"
echo "## codex sandbox :workspace"; bash $P codex sandbox -P :workspace -C $W --; echo "saída: $?"
echo "## systemd-run PrivateNetwork + ProtectHome"
bash $P systemd-run --user --pipe --wait --quiet -p PrivateNetwork=yes -p ProtectHome=read-only --
echo "saída: $?"
Example from the repository
## sem trava
  escreve-dentro ABERTO
  escreve-fora ABERTO
  rede ABERTO
  le-segredo ABERTO
  aviso: lê arquivos fora da pasta; tire segredos do alcance ou corte a rede
ISOLAMENTO: FURADO (2 fuga(s))
saída: 1
## codex sandbox :read-only
  escreve-dentro BLOQUEADO
  escreve-fora BLOQUEADO
  rede BLOQUEADO
  le-segredo ABERTO
  aviso: lê arquivos fora da pasta; tire segredos do alcance ou corte a rede
  aviso: nem a pasta de trabalho é gravável (bom para revisar, não para executar)
ISOLAMENTO: OK
saída: 0
## codex sandbox :workspace
  escreve-dentro ABERTO
  escreve-fora BLOQUEADO
  rede BLOQUEADO
  le-segredo ABERTO
  aviso: lê arquivos fora da pasta; tire segredos do alcance ou corte a rede
ISOLAMENTO: OK
saída: 0
## systemd-run PrivateNetwork + ProtectHome
  escreve-dentro ABERTO
  escreve-fora ABERTO
  rede ABERTO
  le-segredo ABERTO
  aviso: lê arquivos fora da pasta; tire segredos do alcance ou corte a rede
ISOLAMENTO: FURADO (2 fuga(s))
saída: 1

codex-cli 0.163.0, systemd 255. systemd accepted the flags and ran without them; the journal logged "PrivateNetwork=yes is configured, but the kernel does not support or we lack privileges for network namespace, proceeding without".

03Codex, Claude Code, and what each one isolates

According to each one's docs, read on 10/19/2026.

1. Codex

codex exec -s read-only or -s workspace-write runs the model's commands in a sandbox (on Linux, bubblewrap with a seccomp filter, per the codex sandbox docs). The docs recommend workspace-write for unsupervised local work and reserve --yolo for a runner that is already isolated.

codex sandbox -P [profile] -- [command] runs a command of yours in the sandbox, with no model: that's what the rehearsal uses. The :read-only and :workspace profiles were observed on 0.163.0.

04Claude Code: sandbox with explicit failure

This machine is missing socat. With failIfUnavailable, Claude Code refuses to start before any call to the model (it doesn't use your subscription quota).

Terminal · ask for the sandbox and require that it exists
cd /tmp/ensaio-seg/iso
claude --settings '{"sandbox":{"enabled":true,"failIfUnavailable":true}}' -p "responda só: ok" --tools ""
echo "saída: $?"
Example from the repository
Error: sandbox required but unavailable: sandbox is enabled but dependencies are missing: socat not installed · install missing tools (e.g. apt install bubblewrap socat) or see https://code.claude.com/docs/en/sandboxing
  sandbox.failIfUnavailable is set — refusing to start without a working sandbox.

saída: 1

Claude Code 2.1.303. Without failIfUnavailable, per the docs, the same session would have run the commands without a sandbox.

05Practice

The four locks on your machine, and the lock on your loop.

E15 · Proof of the four locks

10 min

Run the rehearsal. Note which locks came back OK on your machine; the systemd result may differ from the one here.

Done when: "sem trava" ends in ISOLAMENTO: FURADO (2 fuga(s)) and saída: 1; "codex sandbox :workspace" in escreve-dentro ABERTO, ISOLAMENTO: OK and saída: 0.

E16 · Claude Code fails loudly

10 min

Run the Claude Code block. If it refuses to start, install the dependencies the error asks for and run it again.

Done when: without the dependencies: refusing to start without a working sandbox and saída: 1; with them: saída: 0.

E17 · The lock on your loop

10 min

Run prova-isolamento.sh with the same wrapper your loop uses to call the agent (the same -s from Codex, the same systemd-run). Note the date and the result in the map ("prova_isolamento"), for lesson 8.

Done when: bash $P [your loop's wrapper] --; echo $? → ISOLAMENTO: OK and 0.

06Lesson quiz

Question 1 of 4

systemd accepted PrivateNetwork=yes with no error. Is the network cut off?skill

07In three sentences

Prove it, don't trust itFour escape attempts tell you whether the lock is standing on your machine.
Fail loudlyfailIfUnavailable in Claude Code; explicit -s in Codex.
Reading is still openSecret out of reach and network cut, together.

Going further

Previous lessonNext lesson