github / github/copilot-cli

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

未關閉
#4,156 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:permissions area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### 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_

貢獻指南

開啟貢獻指南

研究方向

從 CLI 命令分類器著手,檢查 git branch 識別碼如何映射至 readOnly 和 permission.request 事件。使用 git branch -D、-d 和 --delete 重現,然後驗證破壞性變體需要確認,而 git branch -r 仍維持唯讀。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
git
領域
cli, security
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。