Powershell scripts fail with "AuthorizationManager check failed" on Windows using MXC sandbox

Open
#2,594 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
powershell

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.

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.

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.

{
...
  "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?

Dominant language
Java
Stars
10.5k
Forks
1.5k
Avg merge
1d 12h
Merged PRs (30d)
133

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/copilot-sdk

All issues in github/copilot-sdk

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.