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

Manually merged
terra merged 0 commits from neptunus/255-r2 into main 2026-11-27 00:40:12 +00:00
Member

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.

Replaces PR 270: the same reviewed tree, squashed to one commit so the history carries no home paths.

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. Replaces PR 270: the same reviewed tree, squashed to one commit so the history carries no home paths.
The owner's allow rules for a checkout are carried to the engine member: a call the approved list names runs unasked, every other call is still asked. One squash of the reviewed branch (tree of 9b9cae1f) onto main b478e03f.
A declared token_file may be read into a request header, never sent to the terminal. One squash of the reviewed branch (tree of 64246708) onto the martha#241 squash.
terra manually merged commit 5d3c4813e3 into main 2026-11-27 00:40:12 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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!272
No description provided.