Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox
- Langage dominant
- Java
- Étoiles
- 10.5k
- Forks
- 1.5k
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 128
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Reproduisez l’échec sur Windows Insiders avec le sandbox MXC en exécutant un script .\\MyScript.ps1. Commencez par .copilot/settings.json et la configuration powershellFlags, en comparant le lancement défaillant avec le contournement utilisant -NoProfile et -ExecutionPolicy RemoteSigned. C’est terminé lorsque les scripts PowerShell s’exécutent sans l’erreur AuthorizationManager alors que le sandbox reste activé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- powershell
- Domaine
- operating-systems, security
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Active
- Clarté
- À clarifier
- Accessibilité débutants
- 42/100