github / github/copilot-cli

DESTRUCTIVE (forced) git branch deletion is MISCLASSIFIED and requires NO PERMISSION

Đang mở
#4,156 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:permissions area:tools
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

### Describe the bug

Per `/diagnose`:

---

Found it. The root cause is clear from the event log:

- **`git push --delete`** at 20:42:24 → generated a `permission.request` event → you were prompted ✅
- **`git branch -D`** at 20:43:03 → **no `permission.request` event at all** → ran silently ❌

The CLI classifies commands by identifier to determine if they're read-only. In the `git push` permission request, `git push` is correctly tagged `"readOnly": false`. But earlier in the session, `git branch -r` was tagged `"readOnly": true` — and the classifier appears to treat **all `git branch` invocations as read-only**, regardless of flags like `-D`.

In short: **this is a classifier bug in the CLI**. It doesn't recognize that `git branch -D` is destructive, so it skips the permission prompt entirely. `git push --delete` was correctly flagged; `git branch -D` was not.

This is worth reporting via `/feedback` — the `git branch` command classifier needs to recognize `-D` / `-d` / `--delete` as write operations.

### Affected version

GitHub Copilot CLI 1.0.71.

### Steps to reproduce the behavior

- Ask Copilot to delete one or more remote branches to provoke it to call `git push --delete ...`.
- Observe that the command requires user acknowledgement.
- Ask Copilot to delete one or more local branches to provoke it to call `git branch -D ...`.
- Observe that the command runs with no permission prompt.

### Expected behavior

A destructive operation such as DELETING A BRANCH should require confirmation by default.

### Additional context

_No response_

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

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu từ bộ phân loại lệnh CLI và kiểm tra cách các mã định danh git branch được ánh xạ tới các sự kiện readOnly và permission.request. Tái hiện bằng git branch -D, -d và --delete, sau đó xác minh rằng các biến thể mang tính phá hủy yêu cầu xác nhận, trong khi git branch -r vẫn ở chế độ chỉ đọc.

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
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
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
55/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.