Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox
- 主要言語
- Java
- スター
- 10.5k
- フォーク
- 1.5k
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 128
説明
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?
コントリビューションガイド
調査の方向性
MXC sandbox を有効にした Windows Insiders で、.\\MyScript.ps1 スクリプトを実行して失敗を再現します。.copilot/settings.json と powershellFlags の設定から始め、失敗する起動と -NoProfile および -ExecutionPolicy RemoteSigned を使用する回避策を比較します。sandbox を有効にしたまま、AuthorizationManager エラーなしで PowerShell スクリプトが実行されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- powershell
- 領域
- operating-systems, security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 42/100