anthropics / anthropics/claude-code

[BUG] ask permission rule for Bash(git push *) not triggering confirmation prompt

Đang mở
#87,773 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:permissions bug platform:macos stale
Ngôn ngữ chính
Python
Star
145k
Fork
23.1k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code

### What's Wrong?

Description

Environment
- Claude Code version: (run claude --version to get this)
- OS: macOS 24.6.0

What happened
I have the following rule in .claude/settings.json:

"ask": ["Bash(rm *)", "Bash(mv *)", "Bash(git push *)"]

Claude ran git push twice in the same session without triggering a confirmation prompt. The ask rule was silently bypassed.

Expected behavior
Claude should pause and ask for user confirmation before executing any command matching Bash(git push *).

Actual behavior
git push ran without any prompt. The commands that executed were:
git push
(plain push with no additional arguments)

Steps to reproduce
1. Add "Bash(git push *)" to the ask array in .claude/settings.json
2. In a session, ask Claude to push a branch
3. Observe that git push runs without a confirmation prompt

Additional context
The * glob may not be matching a bare git push with no trailing arguments, which could explain why the rule isn't firing. If the pattern requires at least one argument after push, a bare git push would slip through.

---
That last "Additional context" line is worth including — it gives the maintainers a plausible root cause to investigate (glob matching behavior on commands with no trailing args).

### What Should Happen?

Claude should pause and ask for user confirmation before executing any command matching Bash(git push *).

### Error Messages/Logs

```shell

```

### Steps to Reproduce

1. Add "Bash(git push *)" to the ask array in .claude/settings.json
2. In a session, ask Claude to push a branch
3. Observe that git push runs without a confirmation prompt

### Claude Model

None

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

_No response_

### Claude Code Version

2.1.145 (Claude Code)

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

The * glob may not be matching a bare git push with no trailing arguments, which could explain why the rule isn't firing. If the pattern requires at least one argument after push, a bare git push would slip through.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start with .claude/settings.json and reproduce the reported ask rule using a bare `git push`, after checking the installed version with `claude --version`. Trace the permission matching entry point for Bash commands and compare bare `git push` with commands that have trailing arguments; done means the rule consistently triggers a confirmation prompt before the push runs.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
git, shell
Lĩnh vực
cli, security
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
64/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.