Skip to content

investigate: Bash wildcard patterns in ALLOWED_TOOLS not working #154

@frankbria

Description

@frankbria

Summary

Wildcard patterns in ALLOWED_TOOLS (e.g., Bash(git *)) don't appear to work correctly. Even setting ALLOWED_TOOLS="*" still results in permission denials.

This was split from #143 which addressed the display bug for denied commands.

Evidence

User 1 (from #143)

ALLOWED_TOOLS="Write,Read,Edit,Bash(git *),Bash(npm *),Bash(pytest)"

Result: git commit commands blocked

User 2 (from #143)

ALLOWED_TOOLS="*"  # Allow EVERYTHING

Result: Still got permission denied after 1 API call

[2026-02-01 11:56:33] [SUCCESS] 🏁 Graceful exit triggered: permission_denied

Current Implementation

In ralph_loop.sh lines 950-960, tools are added to the command array:

if [[ -n "$CLAUDE_ALLOWED_TOOLS" ]]; then
    CLAUDE_CMD_ARGS+=("--allowedTools")
    local IFS=','
    read -ra tools_array <<< "$CLAUDE_ALLOWED_TOOLS"
    for tool in "${tools_array[@]}"; do
        tool=$(echo "$tool" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
        if [[ -n "$tool" ]]; then
            CLAUDE_CMD_ARGS+=("$tool")
        fi
    done
fi

This looks correct - tools are properly split and added.

Investigation Needed

  1. Verify --allowedTools flag is reaching Claude CLI

    • Add debug logging to print the actual command being executed
    • Confirm the tools array is populated correctly
  2. Test Claude CLI directly

    • Does claude --allowedTools "Bash(git *)" -p "run git status" work?
    • Does claude --allowedTools "*" -p "run npm install" work?
    • Test both interactive and non-interactive modes
  3. Check Claude CLI documentation

    • Does Claude CLI support * as "allow all"?
    • What's the correct wildcard syntax for Bash commands?
    • Is there a difference between Bash(git *) vs Bash(git:*)?
  4. Mode-specific behavior

    • Does the -p flag (non-interactive) have different permission handling?
    • Does --continue affect permissions?

Possible Causes

  1. Claude CLI doesn't support * as "allow all tools"
  2. Claude CLI doesn't support space-based wildcards in non-interactive mode
  3. The --allowedTools flag isn't being passed in all code paths
  4. Shell escaping issues when building the command

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions