Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox
- Vorherrschende Sprache
- Java
- Sterne
- 10.5k
- Forks
- 1.5k
- Ø Merge
- 1 T. 11 Std.
- Gemergte PRs (30 T.)
- 128
Beschreibung
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?
Beitragsleitfaden
Rechercherichtung
Reproduziere den Fehler auf Windows Insiders mit der MXC-Sandbox, indem du ein .\\MyScript.ps1-Skript ausführst. Beginne mit .copilot/settings.json und der powershellFlags-Konfiguration und vergleiche den fehlschlagenden Start mit der Workaround-Lösung unter Verwendung von -NoProfile und -ExecutionPolicy RemoteSigned. Als erledigt gilt die Aufgabe, wenn PowerShell-Skripte ohne den AuthorizationManager-Fehler ausgeführt werden, während die Sandbox aktiviert bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- powershell
- Bereich
- operating-systems, security
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 42/100