A wildcard deny holds its lines; a redirect to nowhere is read, and one that writes a file is asked (#241 + F1, PR 3 of 5 of owner/953-chat) #313

Manually merged
terra merged 0 commits from neptunus/241-redirect-reader into main 2026-11-30 17:26:51 +00:00
Member

Refs #241. This is PR 3 of 5 landing Raf's owner/953-chat branch, per Saturnus's review REVIEW_2026-11-30_owner-953-chat. Neither commit is #241's Done-when (an unattended crew answered by rule); they are fixes inside it.

  • 64c66e00 → 07d65fc8 a wildcard in a shell deny holds its lines, not the whole shell. Cherry-picked unchanged; the review found it sound.
  • f3b4b52a → 787aef6b a redirect that writes nowhere does not make a line unreadable. Cherry-picked unchanged.
  • d470be29 F1 (new): a redirect that writes a file is never read as one that writes nowhere. Each redirect to nowhere must start a word, and a duplication is >& and digits that end the word. So echo pwned >&0/../.bashrc, echo pwned >&2x and ls2>/dev/null are refused and asked again. The test was red first, and two mutants (no start anchor; an unanchored duplication) each turn it red.

Proof at the tip: typecheck, the whole npm run verify, the whole npm test (through run_the_tests_in_a_namespace_of_their_own.sh) and check:private.

The whole suite at this tip: 5753 tests, 1 fail: the known flake #248 (the martha#70 hard-killed-loop case under load). Its file passed 3 of 3 runs on its own, and this PR touches nothing under prove_the_core.

Refs #241. This is PR 3 of 5 landing Raf's owner/953-chat branch, per Saturnus's review REVIEW_2026-11-30_owner-953-chat. Neither commit is #241's Done-when (an unattended crew answered by rule); they are fixes inside it. - 64c66e00 → `07d65fc8` a wildcard in a shell deny holds its lines, not the whole shell. Cherry-picked unchanged; the review found it sound. - f3b4b52a → `787aef6b` a redirect that writes nowhere does not make a line unreadable. Cherry-picked unchanged. - **`d470be29` F1 (new):** a redirect that writes a file is never read as one that writes nowhere. Each redirect to nowhere must start a word, and a duplication is `>&` and digits that end the word. So `echo pwned >&0/../.bashrc`, `echo pwned >&2x` and `ls2>/dev/null` are refused and asked again. The test was red first, and two mutants (no start anchor; an unanchored duplication) each turn it red. Proof at the tip: typecheck, the whole `npm run verify`, the whole `npm test` (through run_the_tests_in_a_namespace_of_their_own.sh) and check:private. The whole suite at this tip: 5753 tests, 1 fail: the known flake #248 (the martha#70 hard-killed-loop case under load). Its file passed 3 of 3 runs on its own, and this PR touches nothing under `prove_the_core`.
A rule like `Bash(git push * --force:*)` was read as a hold on the entire shell,
so an owner who wrote one had every shell call held back: `ls`, `cat` and
`git status` asked even where the allow list named them. A wildcard inside a
hold's command now holds every line beginning with the words before it, which is
wider than the pattern and never narrower; a wildcard in the first word still
holds the whole shell.
A redirect to /dev/null, or a duplication of a descriptor such as 2>&1, writes
nothing and runs nothing, so it is taken out before a shell line is read:
`ls 2>/dev/null` is the command `ls`, and an owner's `Bash(ls:*)` names it. A
redirect to any other path still refuses the line, as a file no rule named, and
a substitution, a group, a function or a backgrounded command still does too.

The test that held the old rule now holds both: the redirect to a file is
asked, the redirect to /dev/null is read, and a compound line whose every part
the owner allowed runs unasked.
The redirect reader stripped `>&0` out of `>&0/../.bashrc` and `>&2` out of
`>&2x`, and `2>/dev/null` out of `ls2>/dev/null`. Bash, zsh and sh write the
file the word names for the first two and run `ls2` for the third, so a line
an allowed command started could write any path unasked (Saturnus's review of
owner/953-chat, F1; the Supervisor's #241 rule 3, a redirection into a file is
asked).

Each redirect to nowhere now starts a word, and a duplication is `>&` and
digits that end the word. A test holds the three lines refused and the real
duplications still taken out; two mutants (no start anchor, an unanchored
duplication) each turn it red.

Refs #241
terra referenced this pull request from a commit 2026-11-30 17:02:04 +00:00
terra manually merged commit d470be2962 into main 2026-11-30 17:26:51 +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!313
No description provided.