allowlist entry readonly

This commit is contained in:
hermes committed 2026-11-14 11:29:03 +00:00
1 parent 9ce4756fad
commit e668eb1b0d
4 files changed
+182 -7

No files matched your search

+8
View File
@@ -249,6 +249,14 @@ subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-
check(run("foreign", "sec", env=senv, body="CALL read a.txt"), "failed", "setup:")
subprocess.run(["git", "rm", "-q", "-r", ".hx"], cwd=repo, check=True)
subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@t", "commit", "-qm", "rm"], cwd=repo, check=True)
# `readonly` entry: looking commands pass through the real guard, running/writing ones do not
profile("ro", f'home = "{work_home}"\nallow = ["readonly", "write"]\n')
s = check(run("ro-ok", "ro", env=senv, body="CALL bash ls -la\nCALL bash rg -n foo .\nCALL bash git status\nCALL write a.txt"), "done")
assert git_show(s["branch"], "calls.txt").count("RAN") == 3
for name, call in [("ro-exec", "CALL bash find . -exec rm {} +"), ("ro-rm", "CALL bash rm a.txt"), ("ro-chain", "CALL bash ls; rm a"),
("ro-secret", "CALL bash cat .env"), ("ro-out", "CALL bash ls /etc")]:
check(run(name, "ro", env=senv, body=call), "needs-human", "policy:")
# the guard process alone (no orch kill racing it): block / continue over the extension protocol
gwt = tmp / "gwt"
gwt.mkdir()