Skip to content

Deny a Hook-Bypass Commit or Push Nested Past the Write Guard's Wrapper Cap #3010

Closed

Description

@ptr727

Finding

Raised by CodeRabbit on the develop -> main promotion #3002, against the substitution-body readings host-setup/agent-safety/README.md describes (added in #2994 and #3001).

_check_bypass_flags in host-setup/agent-safety/claude/gh-write-guard.py collects overflow from _embedded_wrapper_commands, but reads it only for gh pr merge --admin. A git commit --no-verify, a git push --no-verify, or a core.hooksPath override inside a body nested past _WRAPPER_NESTING_LIMIT reaches none of those checks, so the command is allowed.

A constructed probe, git commit --no-verify -m x wrapped in six levels of bash -c '...', is allowed by both origin/main's guard and develop's, while the same command under two levels is denied. So this predates #2994 and the promotion does not introduce it. #2994 reads substitution bodies through the same capped walk, so a deep enough substitution body joins the same gap.

This is the bypass-flag instance of the class #2943 "Other Rules Past the Wrapper Nesting Cap" names, which lists rule 6 and the gh-write rules but not this check.

Fix Shape

In _check_bypass_flags, deny where overflow holds a body that names a git commit or push (the reading _names_push and a commit counterpart give), the way the push check already returns "wrapper shells or substitutions nested deeper than the guard reads". Keep the quoted eval exception. Add _GIT_CASES rows for a nested-past-the-cap --no-verify commit and push, and a hooks-path override, with an allowed control below the cap. Then qualify the README statements to say nested bodies are read up to the cap and a git commit or push past it is denied.

Activity

  1. added
    script
    on Oct 14, 2026
  2. ptr727 commented on Oct 15, 2026

    @ptr727
    OwnerAuthor

    Claimed for an engineering-track lane (handoff #3040 resume). Branch: feature/guard-hidden-commands-3010. Predicted file set: host-setup/agent-safety/claude/gh-write-guard.py, host-setup/agent-safety/claude/test_install.py, host-setup/agent-safety/README.md, host-setup/agent-safety/claude/README.md.

  3. added a commit that references this issue on Oct 15, 2026
    b4fe684
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    script

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions