Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions host-setup/agent-safety/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,15 @@ Requirements 1 to 7 and 11 judge a command's text, read the way a simple lexer r

```mermaid
flowchart TD
cmd["Tool call: a shell/git/gh command"] --> isgit{"A git operation\nthat bypasses a\nbranch rule\nor a bypass flag?"}
cmd["Tool call: a shell/git/gh command"] --> isbig{"A git or gh command\nwhose brace expansion\npasses 64 distinct or\n1024 words in all?"}
isbig -- yes --> denybig["DENY - too large\nto read"]
isbig -- no --> isgit{"A git operation\nthat bypasses a\nbranch rule\nor a bypass flag?"}
isgit -- yes --> deny4["DENY - requirement 4\n(fails closed for a\nprotected-default branch\nwith undeterminable rules)"]
isgit -- no --> isprimary{"A mutating git op\ntargeting a primary\ncheckout, not exempt?"}
isprimary -- yes --> deny6["DENY - requirement 6"]
isprimary -- no --> iswait{"A while, until or\narithmetic-for loop\nthat sleeps, with no\narithmetic guard, no\nwhile read,\nand (no timeout, or a\nfork out of the timeout's\nreach)?"}
isprimary -- no --> isblanket{"A blanket git add or\nstage, or a commit with\n-a or a sweeping or unread\npathspec, not a dry run,\nin a checkout with\nan origin remote?"}
isblanket -- yes --> deny11["DENY - requirement 11"]
isblanket -- no --> iswait{"A while, until or\narithmetic-for loop\nthat sleeps, with no\narithmetic guard, no\nwhile read,\nand (no timeout, or a\nfork out of the timeout's\nreach)?"}
iswait -- yes --> deny7["DENY - requirement 7"]
iswait -- no --> isghwrite{"A GitHub-write\ncommand at all?"}
isghwrite -- no --> allow["ALLOW"]
Expand Down
4 changes: 2 additions & 2 deletions host-setup/agent-safety/claude/gh-write-guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,7 @@ def classify(
}
_PUSH_CASES: list[tuple[str, dict[str, set[str] | None], str, str, str]] = [
(c, _RULE_SETS[k], b, w, s)
for w, s, k, b, c in (x.split(":", 4) for x in "".join(_PUSH_PACKED).split("|"))
for w, s, k, b, c in (x.split(":", 4) for x in _PUSH_PACKED.split("|"))
] + [(_COMMIT_THEN_PUSH, _RULES, "feature/x", "deny", "R4")]

_IN_PLACE_GROUPS: list[tuple[str | None, str | tuple[str, ...]]] = [
Expand Down Expand Up @@ -2332,7 +2332,7 @@ def _rows(packed: str, expand: str) -> list[list[str]]:
{k: {"pull_request"} for k in r.split(",") if k != "-"},
w,
)
for c, r, w in (x.split(" => ") for x in "".join(_PUSH_UNREAD_PACKED).split("|"))
for c, r, w in _rows(_PUSH_UNREAD_PACKED, "@")
]


Expand Down
Loading