github / github/copilot-cli

Permission scanner misclassifies git -L arguments and shell command text as directory paths

Đang mở
#4,221 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:permissions
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

Copilot CLI incorrectly flags parts of a shell command as directory access candidates when running `git log -L ...` with a search expression that starts with `/`.

In my case, the permission prompt displayed a synthetic "path" composed of:

- the `git log -L` search expression
- a source file path
- trailing shell text such as `&& printf`

This is not a real filesystem path. It appears the permission scanner is lexically collecting slash-prefixed command arguments and adjacent shell text, then presenting the result as an "Allow directory access" prompt.

### Affected version

GitHub Copilot CLI 1.0.73

### Steps to reproduce the behavior

Run a shell command shaped like this:

```bash
cd /REPO_ROOT && printf '%s\n' '---marker---' && git --no-pager log --oneline -L '/requestMatchers(HttpMethod).GET, "/some-route"/,+1:/project-module/src/main/java/com/example/security/SecurityConfig.java'
```

Then ask Copilot CLI to execute it under normal permissions.

### Actual behavior

Copilot CLI shows an **Allow directory access** prompt and presents a "path" that is actually a mixture of:

- the `-L` search expression
- the Java source path
- trailing shell tokens such as `&& printf`

Example of the misclassified candidate shape:

```text
/requestMatchers(HttpMethod).GET, "/some-route"/,+1:/project-module/src/main/java/com/example/security/SecurityConfig.java && printf
/**
/requestMatchers(HttpMethod).GET,
/\*\*
/,+1:/project-module/src/main/java/com/example/security/SecurityConfig.java
```

This is not a valid directory path and should not be treated as one.

### Expected behavior

Copilot CLI should not interpret `git -L` expressions or adjacent shell command text as filesystem paths.

If path scanning is needed, it should distinguish between:

- actual filesystem arguments
- regex/search expressions
- shell syntax and chained commands

### Impact

This causes unnecessary permission prompts on normal investigation commands and interrupts the workflow.

### Additional context

This looks related to other permission/path misclassification issues, especially cases where slash-prefixed strings or URL-like arguments are treated as local paths.

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

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

Hướng nghiên cứu

Tái hiện lời nhắc cấp quyền bằng lệnh shell được cung cấp, sau đó truy vết trình quét quyền của CLI, trình này thu thập các ứng viên đường dẫn từ các đối số git -L và văn bản shell được nối chuỗi. So sánh danh sách ứng viên với đối số hệ thống tệp thực tế và xác minh rằng biểu thức tìm kiếm cùng các token shell ở cuối không còn tạo ra lời nhắc truy cập thư mụ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, 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
Í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.