github / github/copilot-cli

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

オープン
#4,156 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:permissions area:tools
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。