You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bound the Guard's Shift-Line Heredoc Work So a Crafted Command Cannot Outrun the Hook #2198
The #2112 fix on branch feature/auto-2112 (handoff #2123) makes _heredoc_shift_ends in host-setup/agent-safety/claude/gh-write-guard.py do work quadratic in the openers on a line holding (( or $[, times the lines after it, where develop does work linear in the openers. A PreToolUse hook that runs past its timeout fails open, so a command slow enough to read lets the command run unjudged.
Reproduce (constructed)
A command of about 55 KB, one : $((0)) line followed by 1000 << X openers, then 3000 filler lines, takes about 78 s on the branch against about 3 s on develop. No agent writes this shape by accident.
Done looks like
A shift line reads at most a bounded number of openers before the command is treated as past the reading limit and denied, and a self-test row pins a command past that bound as a deny.
Found by the third local strict review pass of the #2112 fix, and filed as a follow-up per decision #2126.
Activity
Strip Every Heredoc Body a Line Opens in the Wait-Loop Rule (#2203)