Norma's tool.Capture writes an oversized tool output to a file in
ToolOutputDir, from the server process. ARTEX passed <run dir>/cmd-output:
the executor can write in the run directory and could turn cmd-output into
a symlink, so root wrote the spill where the link pointed.
- With the privilege drop on, ToolOutputDir is <data>/spill/tasks/<id> for
the worker, the main agent and the planner of a task, and
<data>/spill/sessions/<id> for a chat. The server creates it when the
run starts (agent.SetSpillDirMaker, same style as SetRunDirMaker):
root:<exec gid> 0750 below root:root 0755 parents, each level through a
descriptor opened with O_NOFOLLOW. A directory that cannot be created
leaves the run without a spill directory (output is truncated), never
with the run directory. Without the drop the path stays
<run dir>/cmd-output.
- Norma v0.4.11 writes the spill file 0600 (directory 0700), so the
executor could not read it. The runs wrap their hooks (agent.SpillHooks):
after a tool call whose result carries the spill marker, the server makes
the files of the directory root:<exec gid> 0640. The agent reads a spill
with Bash; the file tools do not reach outside the run directory.
- The spill directory follows the task: stageTaskFiles moves it to the
delete staging with tasks/<id>, stageTaskArchiveFiles packs it as
files/spill/tasks/<id>, and installTaskArchiveFiles restores it and puts
its ownership back. Deleting a conversation removes
spill/sessions/conv-<id>.
Tests: TestToolOutputDir (agent); TestDeleteTaskFilesRemovesSpillDir,
TestRemoveConversationSpill and the archive round trip (server); root-only
TestSpillDirAsRoot, and the spill directory in
TestTaskArchiveRestoreRunDirOwnershipAsRoot. SECURITY.md drops the spill
from the residual list.
The task and chat workspace trees were shared whole with the executor
group, and the main agent and the planner worked in tasks/<id>, the parent
of every worker directory: the executor could rename, remove or replace a
run directory, its own included, and plant entries beside them.
- Layout: no agent working directory is an ancestor of another. The main
agent and the planner work in tasks/<id>/main, a worker in
tasks/<id>/i<N>, a chat in sessions/<id>. With the privilege drop on,
tasks/, sessions/ and tasks/<id> are root:root 0755 and only the leaves
are root:<exec gid> 2775.
- PrepareExecPrivilege no longer shares tasks/ and sessions/. It sets the
parents, shares the leaves found on disk with what they hold, and
registers the run-directory maker (agent.SetRunDirMaker). ensureRunDir
and the chat session directory go through it: each level is created
with Mkdir and set through a descriptor opened with O_NOFOLLOW, parents
before the leaf, so a link planted where a run directory goes is
refused. Without the drop both stay a plain MkdirAll.
- Uploads for the main agent land in tasks/<id>/main/uploads, and the
attachment paths given to it use the same directory; session uploads
create sessions/<id> by the same rule.
- Task archives still pack and delete the whole task directory, so the
package holds files/tasks/<id>/main and i<N>. The package keeps neither
owners nor directory modes: the restore puts the layout back
(installTaskArchiveFiles takes the privilege).
- Existing data is not migrated. Files a task wrote directly in
tasks/<id>/ stay there with their owner and mode; the main agent starts
in an empty tasks/<id>/main and its file tools no longer reach them.
Tests: TestRunDirLayout and TestIsRunDirName (agent); root-only
TestRunDirLayoutAsRoot, TestRunDirSiblingsProtectedAsRoot,
TestRunDirLayoutOnExistingTreeAsRoot and
TestTaskArchiveRestoreRunDirOwnershipAsRoot (server). The archive tests
use the main/ and i<N> leaves. SECURITY.md states the invariant, names the
race that remains and drops ensureRunDir from the residual list.
Two root file operations took a path the agent controls.
- ingest_bbot opened the path it was given with os.Open in the server
process, which is root in the image: any root-readable file could be
named, and the result counts told its line structure. The tool now opens
the file through the file tools' confinement (openWorkRoot on the run's
working directory under the data directory, then os.Root): an absolute
path elsewhere, "..", a symlink, a hard-linked file and a run directory
reached by a symlink are refused. It fails closed without a data
directory or a working directory. The worker passes its data directory
to the ToolSet (SetWorkBase); the tool reads the ToolContext for the
working directory, like ingest_scan_output.
- execPython wrote the script of a custom tool as root to
<run dir>/.tools and then chowned it. The executor can write the run
directory, so it could turn .tools into a symlink and have root create
and chown a file elsewhere. With the privilege drop on, the script now
goes to <data>/exec-scripts, created by PrepareExecPrivilege as
root:<exec gid> 0750, outside tasks/ and sessions/: the executor reads
the 0640 script and cannot create, rename or replace an entry. An
enabled drop without that directory is an error, not a fallback to the
run directory. Without the drop nothing changes. PrepareExecPrivilege
takes the privilege by pointer to record ExecPrivilege.ScriptDir.
Tests: TestOpenBbotOutputConfined and TestIngestBbotToolConfined (no
Postgres), TestExecPythonNeedsScriptDirWhenDropping, and the root-only
TestExecPythonScriptDirAsRoot (.tools planted as a symlink to a root-only
directory). TestIngestBbotScopeSplit now places its file in a run
directory. SECURITY.md: the two paths leave the residual list; the
command-output spill stays.
GHSA-prm8-vw2v-wjwh: the agent command executor ran as root in the server's
container and PID namespace, so it could read /app/keys and recover the
server secrets from /proc/<pid>/environ.
Deliverable 1, executor identity. Agent processes (Bash, the interactive
shell, custom tools, stdio MCP servers) run as the uid/gid set by
-exec-uid and -exec-gid (default 10001). Custom tools use
SysProcAttr.Credential. Norma starts Bash and the shell itself, so a PATH
shim (the server binary named bash) drops the identity before exec; MCP
stdio commands run through the same binary in drop mode. The task and chat
workspace trees are shared with the executor group (setgid, group rw,
umask 002). The key files and the config file become root-only, and
/app/keys is 0700 in the image. An explicit -exec-uid that cannot be applied
stops the start; the default logs once that same-uid isolation is
unavailable when the server is not root.
Deliverable 2, sealed environment. On Linux, SealProcessEnv re-executes the
server once with the secret variables removed from its environment block,
passing the values through an inherited pipe. The new image restores them
into the Go environment, so readers see the same configuration. Off Linux it
logs that the environment is not sealed.
Deliverable 3, approval gate. Custom tools, MCP servers and skill files
(create_/update_ of custom tool and MCP, create_skill, update_skill_file)
meet built-in ask rules seeded once (intercept_persistence_rules_v1). A user
allow rule cannot skip them; a user deny still wins. The rules are data the
agent cannot edit.
Tests: resolution and refusal of root identities, drop command wrapping,
sealed-environment encoding, and an end-to-end handoff test on Linux that
checks the kernel environment block and a child process hold no secret
names and that the values survive (empty and multi-line included). Approval
matching is tested in intercept.