The five file tools act with the rights of the process. The authorization
classes say *whether* a tool may run, never *where*: a model with mutate rights
- or a prompt-injected one - could write ~/.ssh/authorized_keys or the config
that names the plugins this harness loads.
core { tools_root = ~/src } closes that. Empty (the default) means no boundary,
so an existing setup is unchanged.
What makes it hold, rather than look like it:
- every path is resolved before it is used, and the resolved path is what the
tool then opens (realpath for existing paths, resolve_target for one that
does not exist yet, so a dangling symlink cannot be followed out);
- search resolves every entry it recurses into: stat() follows a directory
symlink, so guarding only the argument left a door open (found and fixed in
this change, the test went red without it);
- the root is resolved once at startup, and a root that does not exist is
refused with the path in the message instead of matching nothing;
- run cannot be fenced (a shell opens any path); it starts in the root, and a
failed chdir is written into the tool's observation, not the operator's
terminal.
Verified: an escape by absolute path, by ../.., by a symlink inside, by a
dangling symlink, and through search's recursion are all refused in the live
engine path (scripted model, tool call in the session log); the same tree
inside the root still reads; without tools_root everything behaves as before.
Each guard was removed once to watch the test go red. tests: test_builtin,
test_config, test_secrets ok; make check: all tests passed; check_asan: all 46
binaries clean.