github / github/copilot-sdk

Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox

Đang mở
#2,594 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
129

Mô tả

I've set up Copilot CLI to use the new MXC sandbox on Windows insiders.

## Issue
When the agent is trying to run a powershell script like `.\MyScript.ps1` it gets a sandbox error in return.
```powershell
AuthorizationManager check failed.
CategoryInfo: SecurityError
FullyQualifiedErrorId: UnauthorizedAccess
Exit code: 1
```

## Workaround
After some digging it seems to be causes by powershell not being able to read the registry, so it can't get the current execution profile.
I changed `.copilot\settings.json` to set the ExecutionPolicy at launch and that worked.
```json
{
...
"powershellFlags": [
"-NoProfile",
"-NoLogo",
"-ExecutionPolicy",
"RemoteSigned"
],
...
}
```

Not sure what is a good fix here. Maybe copilot should load the execution policy from the user profile and inject it directly instead of letting powershell try to read it from registry?

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 trên Windows Insiders với MXC sandbox bằng cách chạy một tập lệnh .\\MyScript.ps1. Bắt đầu với .copilot/settings.json và cấu hình powershellFlags, so sánh lần khởi chạy bị lỗi với cách khắc phục sử dụng -NoProfile và -ExecutionPolicy RemoteSigned. Được xem là hoàn tất khi các tập lệnh PowerShell chạy mà không có lỗi AuthorizationManager trong khi sandbox vẫn được bật.

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

Đánh giá

Công nghệ
powershell
Lĩnh vực
operating-systems, security
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
42/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.