Skip to content

The Guard's Wait-Loop Depth Cap Allows a Loop Nested Past It #2205

Closed as not planned

Description

@ptr727

Problem

_unbounded_wait_loop and _sleeps stop reading at a recursion depth of four and return "no loop" past it. A loop nested five quoting levels deep is therefore allowed, although bash still runs it. That makes the cap fail open, where the rest of the wait-loop rule fails closed.

Reproduce (constructed)

Build the command by applying shlex.quote to while true; do sleep 1; done once per level and prefixing bash -c (or eval ) each time. At four levels the result is denied. At five or six it is allowed, and bash runs the loop.

Done looks like

A payload past the depth cap is read as a deny, or at least is never read as clean, and a self-test row pins a five-level case for both bash -c and eval.

Found by the local strict review of the #2080 fix (handoff #2137). The cap predates that fix, and the eval reading inherits it.

Activity

  1. added
    bug
    agents
    pre-existing
    on Oct 1, 2026
  2. ptr727 commented on Oct 8, 2026

    @ptr727
    OwnerAuthor

    Declined per #2517, approved by the maintainer, under GOVERNANCE.md "Trust Boundaries and Hardening Effort": The guard backstops an agent's own mistakes, and this is a command shape built to defeat it rather than one an agent session writes, so a miss does not realistically occur. See #2517 for the per-issue reason.

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

    agentsbugpre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions