oliver-zehentleitner / maity
runner: the loop's spec and the pane's log in a directory only the runner writes, opened once (follow-up to #2016)
tsk-z7ada6bqsr7q Open
Follow-up to #2016 (security round 5, S201/S202), which ships an allow list as a stopgap.
What: on an ssh host the runner keeps the loop's spec (agents/<placement>/loop.json) and the pane's log (logs/<placement>.log) in the agents' user's ~/.maity-runner, which that user owns. Move them where only the runner's side can write (or hand the file to loop/logcap as an open descriptor), and have both commands open the file once and check that descriptor (fstat: regular file, owner, mode, one link) instead of checking a path and opening it again. The longer aim: an entry point for these in-session commands that an agent cannot reach at all.
Done when: maity runner loop and maity runner logcap act only on a file the agent's user cannot create or replace, checked on the descriptor they use; ssh and local layouts both covered by tests; cli/context/runner.md and docs/runners.md updated in the same PR.
Details of the review findings are with lotse and the security team, not on this card.
Notes
Lotse · Nov 20, 2026, 02:31 UTC
Also in scope (review of #2016):
- A test on a real placement (Claude Code same-user and ssh, opencode, Antigravity) that a command in the session cannot create, rename or write anything under the runner's private paths.
- On an ssh host, the private paths are taken as given (not resolved): resolve the agents' home there too, so a home reached through a link is covered.
- opencode: the same explicit read/write deny for the private paths that Claude Code's sandbox has; Antigravity: confirm its terminal sandbox covers them.
Lotse · Nov 20, 2026, 02:59 UTC
Also from the #2016 review: take the placement a call belongs to from the runner's side, not from an environment variable the session can set, so one placement's commands can name only its own files; and say in runner.md that the checks start at the agents' home from the user database (anything above it is outside what is checked).
Lotse · Nov 20, 2026, 03:06 UTC
Small points from the #2016 review, for this card: treat an empty MAITY_PLACEMENT the same in cli.py and in runner_own_file; make ~/.maity-runner and its subdirectories 0700 explicitly (mkdir -p leaves the parents at the umask, 0775 under umask 002 on a shared-group host); the ssh log pre-check (
test -f) should not follow a link at that path; the test helper should not depend on the umask.Lotse · Nov 20, 2026, 06:54 UTC
From the Grok review of #2016 (P3): a test that fails when the loop path's directory or depth check is dropped (a three-part path under the wrong directory); confirm whether Antigravity's prefix rule for
maity runneralso matchesmaity runnersand pin it either way. The empty-MAITY_PLACEMENT point is already noted above.