[GH-ISSUE #3968] [Other] Manual mode: allowlisted "read-only" commands have write and execute modes that run without a card [AMD Radeon RX 7900 XT, 20GB VRAM, 64GB DDR4 RAM] #1704

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

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

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.

Originally created by @Mqrius on GitHub (Oct 24, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/3968 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.
bsakaguchi 2026-11-04 01:53:19 +07:00
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:6385263025 --> @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

@Mqrius commented on GitHub (Oct 24, 2026):

formatting bot is fighting me

<!-- gh-comment-id:6385763990 --> @Mqrius commented on GitHub (Oct 24, 2026): formatting bot is fighting me
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#1704
No description provided.