Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox
- Dominant language
- Java
- Stars
- 10.5k
- Forks
- 1.5k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 127
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?
Contributor guide
Research direction
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.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100