Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox
- Lingua principale
- Java
- Stelle
- 10.5k
- Fork
- 1.5k
- Merge medio
- 1g 11h
- PR unite (30g)
- 128
Descrizione
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?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Reproduce the failure on Windows Insiders with the MXC sandbox by running a .\MyScript.ps1 script. Start with .copilot/settings.json and the powershellFlags configuration, comparing the failing launch with the workaround using -NoProfile and -ExecutionPolicy RemoteSigned. Done means PowerShell scripts run without the AuthorizationManager error while the sandbox remains enabled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- powershell
- Ambito
- operating-systems, security
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 42/100