Skip to content

Agent guards: ignore shell comments when matching blocked commands #1057

Done

Description

@scuttletoby

The agent-guards kit matches blocked commands even inside shell comments (a line like # never run X is refused). Comments should be ignored before matching, with a test that a commented-out pattern passes and the same pattern as a real command is still refused.

Found during the machine move prep (11-23).

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 27, 2026

    @scuttletoby
    OwnerAuthor

    Follow-up note from #1108 fix round 1: the PR now covers shell comments only (~/.bashrc and the other start files, and sourced files, read for CLAUDE_CODE_SIMPLE; the command's own comments were already skipped).

    Dropped, for a later issue: leaving out comments in Python and JS code (python3 -c / node -e inline code, .py / .js script files, quoted heredocs into an interpreter). Round 0 tried it, and the lens found 16 ways past it (line counting vs Python's tokenizer, # coding: utf-7, language from the file name instead of the program that runs it, JS // inside template literals / /* */ / string continuations, later argv words, joined -cCODE with stdin). Those are kept in #1108 as refused tests; any new attempt must keep them refused and stay to narrow, provable cases.

    🤖 Generated with Claude Code

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions