github / github/copilot-cli

Support persistent command deny-rules in permissions-config.json

Đang mở
#3,995 1 bình luận 2 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ả

### Is your feature request related to a problem? Please describe.
`permissions-config.json` (per-directory `tool_approvals`) only supports **allow** rules (`kind: "read" | "write" | "commands" | "mcp" | "memory"`). There is no way to persistently mark a command family (e.g. a specific CLI tool) as always-denied for a given trusted location. The only related mechanism, `--deny-tool`, is a per-invocation CLI flag (see #2722) - it doesn't persist across sessions and has its own matching bugs (denies ALL reads instead of the pattern, bypassable via `shell(cat ...)`).

Users who want to categorically block a whole command family (cloud CLIs, destructive tools, package managers, etc.) across all sessions in a directory currently have no durable option - they must remember to reject the prompt every single time, or avoid the tool being available at all.

### Describe the solution you'd like
Extend the `tool_approvals` schema (or add a sibling array, e.g. `tool_denials`) in `permissions-config.json` to support explicit deny rules scoped by location, symmetric with today's allow rules:

```json
{
"locations": {
"C:\\path\\to\\project": {
"tool_approvals": [ ... ],
"tool_denials": [
{
"kind": "commands",
"commandIdentifiers": ["some-cli"]
}
]
}
}
}
```
- Deny rules should always take precedence over allow rules and over the default "ask" behavior (deny > ask > allow, matching Claude Code's precedence model).
- Should match the full command family (e.g. `some-cli`, `some-cli subcommand`, etc.), not just literal substrings, to avoid the bypass issues described in #2722.
- Ideally manageable via a CLI/slash command too (e.g. `/deny-tool some-cli`), mirroring `/reset-allowed-tools`.

### Describe alternatives you've considered
- `--deny-tool` per invocation - not persistent, and has matching bugs (#2722).
- Manually rejecting prompts every time - error-prone, no durable guarantee.

### Additional context
Related: #2722 (deny-tool matching bugs, no persistent profiles), #307 (closed) Comprehensive Permissions System Improvements Proposal, #179 (globally configurable allowed tools).

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

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

Hướng nghiên cứu

Start by tracing permissions-config.json and the existing tool_approvals handling, then inspect the --deny-tool path and related issue #2722 for current matching behavior. Review #307 and determine the accepted scope for persistent location-scoped denials, including precedence, command-family matching, and any /deny-tool integration; done means the behavior is implemented and verified for these cases.

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

Đánh giá

Công nghệ
shell
Lĩnh vực
cli, security
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/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.