mirror of
https://github.com/usestrix/strix.git
synced 2026-08-25 04:12:37 +02:00
fix(safety): do not treat data tools reading script-named files as execution
Trace review of two guarded-mode runs found the unresolved-execution guard firing on ordinary commands: curl fetching a .js asset, rg over a .py file, sed and cat and cp on script-named files — 24 blocks in one run. The guard was meant to fail closed on an unknown interpreter handed a script, but a read, transfer, or text tool takes such a file as data, not as a program to run. Exclude known read commands, HTTP clients, and a set of text/data tools from the script-suffix branch, so only a genuinely unknown executable given a script still fails closed. awk moves from the interpreter set to the data tools: its program is an inline positional argument, not a -c or script file the entrypoint reader can resolve. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -898,3 +898,21 @@ async def test_oversize_input_file_is_attached_truncated() -> None:
|
||||
assert inp["bytes"] <= settings.max_artifact_bytes
|
||||
finally:
|
||||
bundle.cleanup()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"command",
|
||||
[
|
||||
"curl -sS https://example.test/js/app.js -o /dev/null",
|
||||
"wget https://example.test/main.bundle.js -O out.js",
|
||||
"rg -n 'pattern' /workspace/app.py",
|
||||
"sed -n '1,20p' /workspace/probe.py",
|
||||
"cat /workspace/onboarding.py",
|
||||
"cp /workspace/a.sh /workspace/b.sh",
|
||||
"awk '{print $1}' /workspace/hosts.py",
|
||||
],
|
||||
)
|
||||
def test_data_tools_reading_script_named_files_are_not_execution(command: str) -> None:
|
||||
"""A read/transfer/text tool takes a script-named file as data, not as a program to
|
||||
run, so it must not trip the unresolved-execution guard."""
|
||||
assert parse_command(command).parse_error is None
|
||||
|
||||
Reference in New Issue
Block a user