[GH-ISSUE #3975] [Other] Manual mode: allowlisted "read-only" commands have write and execute modes that run without a card #1706

Closed
opened 2026-11-04 01:53:21 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @Mqrius on GitHub (Oct 24, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3975

Several pre-approved read-only commands can in fact execute arbitrary files or writes. In manual mode you don't get a request to confirm them, which seems like a failure of the harness.

I had Opus 5.5 enumerate all of them, though it might have missed something. For safety, the flags for a bunch of these should probably be block-by-default as well.

The rest of this report is written by Opus:

Version

Checked against v0.2.4 (96ca4383), apps/host/server/agent/plugins/strata-gate.mjs.

Summary

isReadOnlyShell lets a command run unasked if every pipeline segment starts with a word from SAFE_COMMANDS, and the only per-word flag check is ^-(delete|exec|execdir|fprint|fls|ok)$ (line 126). Several allowlisted commands can write files or start other programs through options or arguments that this check doesn't cover. In Manual mode these run with no approval card.

This is from reading the code plus each tool's documented options. I haven't run these through the app.

Command (allowlisted) Unasked effect How
sort runs a program sort --compress-program=PROG (GNU sort runs PROG for its temp files)
rg runs a program rg --pre PROG pattern runs PROG for every file searched
git grep (in SAFE_GIT) runs a program git grep -O<cmd> / --open-files-in-pager=<cmd>
sort writes a file sort -o FILE, --output=FILE
uniq writes a file uniq IN OUT: the second operand is the output file, no flag needed
tree writes a file tree -o FILE
file writes a file file -C -m X compiles X into X.mgc
date changes the system date -s / --set (needs admin rights)
tail never ends tail -f

The three "runs a program" cases matter most: they turn a look-only command into running an arbitrary program, and the program name doesn't need to be one of the words UNSAFE_SYNTAX blocks (sh, bash, pwsh, ...).

The flag check also only matches the exact short forms: attached or long forms like --output=FILE and -oFILE don't go through any check.

Suggestion

Flip the per-command check from a deny-list of flags to an allow-list of flags per command, e.g. sort: [-r -n -u -k -t -f -h -V ...], uniq: [-c -d -u -i] with at most one positional argument, rg: [-i -n -l -c -w -F -e -g --type ...], and so on. The allowlist is small (about 50 words), so the safe options for each command can be listed completely, and anything else asks. That also removes the need to remember every tool's exotic options when a word is added later.

Thanks for the fail-closed design and gate-fail-closed.test.mjs. This is a hole in the classifier's coverage, not its structure.

Problem: See above
Environment: 96ca4383, windows 10, AMD Radeon RX 7900 XT 20GB VRAM, 64 RAM
Reproduce: See above
Expected: See above
Actual: See above
Evidence: See above
Reproduction status: See above

Originally created by @Mqrius on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3975 Several pre-approved read-only commands can in fact execute arbitrary files or writes. In manual mode you don't get a request to confirm them, which seems like a failure of the harness. I had Opus 5.5 enumerate all of them, though it might have missed something. For safety, the flags for a bunch of these should probably be block-by-default as well. The rest of this report is written by Opus: ### Version Checked against v0.2.4 (`96ca4383`), `apps/host/server/agent/plugins/strata-gate.mjs`. ### Summary `isReadOnlyShell` lets a command run unasked if every pipeline segment starts with a word from `SAFE_COMMANDS`, and the only per-word flag check is `^-(delete|exec|execdir|fprint|fls|ok)$` (line 126). Several allowlisted commands can write files or start other programs through options or arguments that this check doesn't cover. In Manual mode these run with no approval card. This is from reading the code plus each tool's documented options. I haven't run these through the app. | Command (allowlisted) | Unasked effect | How | |---|---|---| | `sort` | **runs a program** | `sort --compress-program=PROG` (GNU sort runs PROG for its temp files) | | `rg` | **runs a program** | `rg --pre PROG pattern` runs PROG for every file searched | | `git grep` (in `SAFE_GIT`) | **runs a program** | `git grep -O<cmd>` / `--open-files-in-pager=<cmd>` | | `sort` | writes a file | `sort -o FILE`, `--output=FILE` | | `uniq` | writes a file | `uniq IN OUT`: the second operand is the output file, no flag needed | | `tree` | writes a file | `tree -o FILE` | | `file` | writes a file | `file -C -m X` compiles X into X.mgc | | `date` | changes the system | `date -s` / `--set` (needs admin rights) | | `tail` | never ends | `tail -f` | The three "runs a program" cases matter most: they turn a look-only command into running an arbitrary program, and the program name doesn't need to be one of the words `UNSAFE_SYNTAX` blocks (`sh`, `bash`, `pwsh`, ...). The flag check also only matches the exact short forms: attached or long forms like `--output=FILE` and `-oFILE` don't go through any check. ### Suggestion Flip the per-command check from a deny-list of flags to an **allow-list of flags per command**, e.g. `sort: [-r -n -u -k -t -f -h -V ...]`, `uniq: [-c -d -u -i]` with at most one positional argument, `rg: [-i -n -l -c -w -F -e -g --type ...]`, and so on. The allowlist is small (about 50 words), so the safe options for each command can be listed completely, and anything else asks. That also removes the need to remember every tool's exotic options when a word is added later. Thanks for the fail-closed design and `gate-fail-closed.test.mjs`. This is a hole in the classifier's coverage, not its structure. Problem: See above Environment: 96ca4383, windows 10, AMD Radeon RX 7900 XT 20GB VRAM, 64 RAM Reproduce: See above Expected: See above Actual: See above Evidence: See above Reproduction status: See above
Author
Owner

@github-actions[bot] commented on GitHub (Oct 24, 2026):

Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing:

  • Add your graphics card with its VRAM, your RAM and your operating system.

Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment /reopen.

Details: CONTRIBUTING.md

<!-- gh-comment-id:6385766086 --> @github-actions[bot] commented on GitHub (Oct 24, 2026): Thanks for the issue. To keep the tracker readable, every item needs an area prefix in the title and the parts of the issue form filled in. This one is missing: - [ ] Add your graphics card with its VRAM, your RAM and your operating system. Edit the issue (title and description) and this note goes away on its own. If it is still missing parts in 5 days it will be closed, which is not a rejection: fix it and comment `/reopen`. Details: [CONTRIBUTING.md](https://github.com/Niko1221/Strata/blob/main/CONTRIBUTING.md)
Author
Owner

@github-actions[bot] commented on GitHub (Oct 24, 2026):

Thanks, this follows the format now.

<!-- gh-comment-id:6385912395 --> @github-actions[bot] commented on GitHub (Oct 24, 2026): Thanks, this follows the format now.
Author
Owner

@Niko1221 commented on GitHub (Oct 27, 2026):

Thanks for the detailed list. Every case in the table now asks (sort -o and --compress-program, rg --pre, git grep -O, uniq IN OUT, tree -o, file -C, date -s, tail -f), and so do the spellings the old check missed (attached, clustered, abbreviated, quoted). The allowlist now works the way you suggested: each command has a list of options that only look, and any other option asks. Fixed in 0.2.7.

Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7

<!-- gh-comment-id:6445963117 --> @Niko1221 commented on GitHub (Oct 27, 2026): Thanks for the detailed list. Every case in the table now asks (sort -o and --compress-program, rg --pre, git grep -O, uniq IN OUT, tree -o, file -C, date -s, tail -f), and so do the spellings the old check missed (attached, clustered, abbreviated, quoted). The allowlist now works the way you suggested: each command has a list of options that only look, and any other option asks. Fixed in 0.2.7. Release: https://github.com/Niko1221/Strata/releases/tag/v0.2.7
Sign in to join this conversation.
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
Niko1221/Strata#1706
No description provided.