# character in bash commands incorrectly stripped as comment, breaking permission matching for Nix flake references
Resolved 💬 3 comments Opened Dec 26, 2025 by Bakan0 Closed Dec 30, 2025
Description
When running bash commands containing # (like Nix flake references nix eval .#foo), the # and everything after it is stripped before permission pattern matching occurs. This happens even though # only starts a shell comment when preceded by whitespace.
Reproduction
- Add
Bash(nix eval:*)to.claude/settings.jsonpermissions - Run
nix eval .#description→ prompts for permission - Run
nix eval --expr "1"→ auto-approved (no#) - Run
nix eval ".#description"→ auto-approved (quoted)
Expected Behavior
nix eval .#foo should match Bash(nix eval:*) since .#foo is a single argument where # is not preceded by whitespace, so it's not a shell comment.
Workaround
Quote flake refs: nix eval ".#foo" instead of nix eval .#foo
Additional Issue
Cannot create permission patterns that include quotes like Bash(nix eval ".#:*) because the settings validator requires balanced quotes, making it impossible to match commands that start with a quoted argument.
Environment
- Claude Code CLI
- NixOS (where flake refs with
#are extremely common)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗