martha#255: Martha refuses a member's line that prints a declared token file #270

Closed
vesta wants to merge 19 commits from vesta/255-refuse-a-credential-print into main
Member

martha#255: Martha refuses a member's line that prints a declared token file

DECIDED 2026-11-26 "Yes, refuse the print (Recommended)". A crew declares where each host's token is read from (hosts[].token_file), and a tool reads that file into a request header, never onto a terminal (DECIDED 2026-11-22 "Yes, file path only"). Nothing held the other half: in the martha#239 run a member checked its token with cat <file> | head -c 20, and the owner could not tell that ask from a header read because martha answer truncates it. A terminal's bytes reach a pane, a transcript and a log, so the refusal is Martha's to make.

Refused: the file named as a command's word (cat F, head -c 20 F, base64 F, cp F /dev/stdout), except by a command that never prints a file's bytes (ls, stat, chmod, …); the file handed as the input of a command that hands its input on (head < F, cat F | head); and the file's bytes handed to echo or printf, straight (echo $(cat F)) or through a variable the line filled with them (T=$(cat F); echo $T) — each only when the output reaches the terminal, so >&2 counts and a file's own output does not.

Allowed: the file read into a value that goes into a request — curl -H "Authorization: token $(cat F)", tok=$(tr -d '[:space:]' < F), --header @F, and printf '…%s…' "$tok" | curl -K -.

The refusal names the declared file and the way to use it instead: read it into the header. Both hosts reach it, because it reads the shell call's own command — Claude Code's relay and the engine's entry alike. It reads the home from the launch in the spellings its shell hands it, so ~/, $HOME/ and ${HOME}/ all name the same file, and a declared <member> names each member's own.

What it does not hold, by the threat model: a member set on getting the bytes out (python3 -c, a variable exported in one call and echoed in the next, a file written and read back). This is a speed bump in front of an accident, as the git shim is, not a boundary.

Residuals (accepted at review, not refused / over-refused)

Not refused:

  • while read l; do echo $l; done < F
  • cat F | xargs echo
  • a relative path after cd
  • a heredoc body line starting with # is read as a comment (hides nothing a heredoc did not already hide)

Over-refused (a print-free line refused):

  • cp F /tmp/x, grep -c . F, sha256sum F
  • ( read -r T; curl -H "Authorization: token $T" url ) < F

Fixed in the r2 fold-ins: a # comment holding a quote; cat F>&2, cat<F, cat F >& 2, cat F "">/dev/null.

Design note

#255 keeps its own output reader: #241's shell reader must refuse $(, while this rule must read inside it to let -H "Authorization: token $(cat F)" run.

Refs #255, #241, #239

This branch contains martha#241. It carries #241's merge of main in, so #255 can only land after #241 does, and a review of it sees #241's patch as already approved rather than as part of this change.

martha#255: Martha refuses a member's line that prints a declared token file DECIDED 2026-11-26 "Yes, refuse the print (Recommended)". A crew declares where each host's token is read from (`hosts[].token_file`), and a tool reads that file into a request header, never onto a terminal (DECIDED 2026-11-22 "Yes, file path only"). Nothing held the other half: in the martha#239 run a member checked its token with `cat <file> | head -c 20`, and the owner could not tell that ask from a header read because `martha answer` truncates it. A terminal's bytes reach a pane, a transcript and a log, so the refusal is Martha's to make. Refused: the file named as a command's word (`cat F`, `head -c 20 F`, `base64 F`, `cp F /dev/stdout`), except by a command that never prints a file's bytes (`ls`, `stat`, `chmod`, …); the file handed as the input of a command that hands its input on (`head < F`, `cat F | head`); and the file's bytes handed to `echo` or `printf`, straight (`echo $(cat F)`) or through a variable the line filled with them (`T=$(cat F); echo $T`) — each only when the output reaches the terminal, so `>&2` counts and a file's own output does not. Allowed: the file read into a value that goes into a request — `curl -H "Authorization: token $(cat F)"`, `tok=$(tr -d '[:space:]' < F)`, `--header @F`, and `printf '…%s…' "$tok" | curl -K -`. The refusal names the declared file and the way to use it instead: read it into the header. Both hosts reach it, because it reads the shell call's own `command` — Claude Code's relay and the engine's entry alike. It reads the home from the launch in the spellings its shell hands it, so `~/`, `$HOME/` and `${HOME}/` all name the same file, and a declared `<member>` names each member's own. What it does not hold, by the threat model: a member set on getting the bytes out (`python3 -c`, a variable exported in one call and echoed in the next, a file written and read back). This is a speed bump in front of an accident, as the git shim is, not a boundary. <!-- martha#255: append these to the PR body at push time (Mars's VERDICT r=2 PASS, 2026-11-26) --> ## Residuals (accepted at review, not refused / over-refused) Not refused: - `while read l; do echo $l; done < F` - `cat F | xargs echo` - a relative path after `cd` - a heredoc body line starting with `#` is read as a comment (hides nothing a heredoc did not already hide) Over-refused (a print-free line refused): - `cp F /tmp/x`, `grep -c . F`, `sha256sum F` - `( read -r T; curl -H "Authorization: token $T" url ) < F` Fixed in the r2 fold-ins: a `#` comment holding a quote; `cat F>&2`, `cat<F`, `cat F >& 2`, `cat F "">/dev/null`. ## Design note #255 keeps its own output reader: #241's shell reader must refuse `$(`, while this rule must read inside it to let `-H "Authorization: token $(cat F)"` run. Refs #255, #241, #239 **This branch contains martha#241.** It carries #241's merge of main in, so #255 can only land after #241 does, and a review of it sees #241's patch as already approved rather than as part of this change.
An engine member was handed an empty approved list
(`start_an_engine_member.ts:383`, `decide(gate, [])`), so under "B: gate,
then ask" every call the gate allowed went to the owner — a crew left
unattended stopped at its first call. A Claude Code member is not in that
position: its host reads the checkout's own settings itself.

This carries the owner's `permissions.allow` to the engine, read as the host
reads it: `Bash(cmd)` exactly, `Bash(cmd:*)` as that command and every line
beginning with it, a compound line only when every part is named, and
anything not plainly readable — `$(…)`, backticks, process substitution, any
redirection, a backgrounded command — asked of the owner. A bare tool rule
carries whole (`Bash`, `mcp__<server>__<tool>` as the engine's own name). A
rule this cannot read is left asked and named with why, never guessed at.

The order is unchanged and now takes the rules rather than a list: the gate
first, a deny refused whatever the rules name, then the rules, then the
owner. No `allow_always` is ever sent, so nothing is saved in the engine's
own store.

Proved by the three mutants the Supervisor named, each killed by a case: a
non-matching part passing, `$(…)` matching as a word, and a deny losing to a
rule.

The :383 line is wired to approve nothing until #240 (PR 242) lands, so this
tree behaves exactly as before; the rules are connected to it when main is
merged after that.
The rules come from the file the owner already approved, .claude/settings.json,
and nowhere else: not settings.local.json, which is the host's record of dialog
answers an engine has no dialog to give, and not the owner's user settings. A
checkout with no settings file approves nothing; one that is not JSON is refused
by name rather than read as no rules.
The host's shell tool already has one name in the tree, so this imports it
rather than spelling it again, and the MCP prefix stays this slice's own local
constant so it collides with no other file's word.
Neptunus's r=1 note, on this tip: architecture/c4_diagrams.node-test.ts was red with "in no box and not
declared left out: carry_the_owners_allow_rules_to_an_engine". The slice is now named in the engine box's
names and described in its picture, and the Components table's row for that box says what it does. The
page's two checks pass, 28/28, in the local run slot (vesta-241/architecture-run-1.log).
R1: .claude/settings.json is listed among the engine host's launch files and carried by
the gate only under a tree the approval pins; the rules are read from those carried bytes,
never the disk. martha approve records the engine host's fingerprint with the same yes.
R2: ( ) { } make a line unreadable. R3: deny and ask rules hold a call, read wider than an
allow. R4: the four surviving mutants pinned. R5/R6: a start on unreadable rules is refused
and told; each rule left asked is told to the owner. The slice no longer imports the
Claude Code host adapter: the start hands the owner's shell tool name in.
DECIDED 2026-11-26 "Yes, refuse the print (Recommended)". The threat model is
issuecomment-5971. The rule is asked after the gate, beside the git guard, so the
shell calls of both hosts reach it. THE_MEMBERS_PLACE names <member> once, for
the forge transport too.
The slice held '~/' and '~' and so read, to prove_the_core, as writing a path
that starts at the home. The adapter that knows the shell now hands the rule
its spellings (THE_SHELLS_HOME_SPELLINGS) beside the launch environment.
Member

Replaced by PR 272 (neptunus/255-r2, 90fa6717): the same tree, squashed so the history carries no home paths.

Replaced by PR 272 (neptunus/255-r2, 90fa6717): the same tree, squashed so the history carries no home paths.
neptunus closed this pull request 2026-11-26 23:47:50 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
martha-ai/martha!270
No description provided.