Repository navigation
fix: enforce Copilot CLI shim policy on macOS and Linux - #341916
Closed
Don Jayamanne (DonJayamanne) wants to merge 1 commit into
Closed
Don Jayamanne (DonJayamanne) wants to merge 1 commit into
Don Jayamanne (DonJayamanne) wants to merge 1 commit into
Conversation
Read native CopilotCliCommand policy in existing terminals before offering installation, while preserving installed CLI launches and Windows behavior. Fixes microsoft/vscode-internalbacklog#10108 Co-authored-by: Copilot <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Native Linux/Windows execution and macOS managed-policy integration remain unverified for this enterprise-policy enforcement change.
0 open findings
What changed in this PR
Closes the stale-terminal policy gap by making the native Copilot CLI shim enforce installation policy on macOS and Linux while preserving installed-CLI launches.
Changes:
- Adds platform policy readers while retaining Windows behavior.
- Adds policy regressions and updates requirements.
- Adds platform dependencies and bumps the shim to
0.1.1.
No actionable defects were identified.
| File | Description |
|---|---|
src/vs/platform/agentHost/common/agentHostPolicySupport.ts |
Clarifies cross-platform enforcement in a comment. |
copilot_shim/src/runtime.rs |
Delegates policy checks to the shared reader. |
copilot_shim/src/policy.rs |
Adds Linux/macOS readers and tests. |
copilot_shim/src/lib.rs |
Registers the policy module. |
copilot_shim/src/app.rs |
Tests policy blocking and installed-CLI bypass. |
copilot_shim/REQUIREMENTS.md |
Documents policy behavior and validation limits. |
copilot_shim/Cargo.toml |
Adds dependencies and bumps the version. |
copilot_shim/Cargo.lock |
Locks dependencies and the new version. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Karthik Nadig (karthiknadig)
added a commit
that referenced
this pull request
Oct 19, 2026
… macOS shim (#342101) * linux: expose the Copilot shim in DEB/RPM packages Honor Linux installation policy and preserve the official installer PATH. Manage Stable and Insiders command ownership through guarded package lifecycle hooks. Add native runtime regressions and a focused package lifecycle harness while leaving deferred packaging formats and non-Linux behavior unchanged. Co-authored-by: Copilot <[email protected]> * test: fix Copilot package launcher and rendering checks Use a scenario-local profile for root launcher validation and ignore disabled shell comments when checking unresolved package placeholders. Preserve strict helper validation and add focused regressions. Co-authored-by: Copilot <[email protected]> * copilot: apply the CopilotCliCommand policy to Linux packages and the macOS shim The Linux DEB/RPM scripts now ask the shim for the CopilotCliCommand policy before managing /usr/bin/copilot, matching Windows setup: a disabled policy removes a link to either edition's shim instead of creating one, and an unreadable policy leaves the entry unchanged. DEB packages add a preseedable <package>/add-copilot-command debconf question (medium priority, default true) that lets an edition opt out; hand-over on removal respects the other edition's answer and the policy. The shim gains `--vscode-shim policy`, which exits 0 when the policy allows the command and 10 when it turns it off, and reads the policy on macOS from the configuration-profile domains of every quality (ported from #341916). Co-authored-by: Don Jayamanne <[email protected]> Co-authored-by: Copilot <[email protected]> * test: drop rendering tests that only exercised the harness validator Keep the checks of the real link helper source and the DEB/RPM templates; the removed cases tested the package-lifecycle harness's own validator rather than product code. Co-authored-by: Copilot <[email protected]> * copilot: bump the shim to 0.1.2 main's #342224 and this branch both changed the shim and bumped it from 0.1.0 to 0.1.1. Windows setup keeps a published shim whose file version matches, so the merged shim needs its own version to replace main's 0.1.1. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Don Jayamanne <[email protected]> Co-authored-by: Copilot <[email protected]>
Don Jayamanne (DonJayamanne)
added a commit
that referenced
this pull request
Oct 19, 2026
#342660) copilot: apply the CopilotCliCommand policy to Linux packages and the macOS shim (#342101) * linux: expose the Copilot shim in DEB/RPM packages Honor Linux installation policy and preserve the official installer PATH. Manage Stable and Insiders command ownership through guarded package lifecycle hooks. Add native runtime regressions and a focused package lifecycle harness while leaving deferred packaging formats and non-Linux behavior unchanged. * test: fix Copilot package launcher and rendering checks Use a scenario-local profile for root launcher validation and ignore disabled shell comments when checking unresolved package placeholders. Preserve strict helper validation and add focused regressions. * copilot: apply the CopilotCliCommand policy to Linux packages and the macOS shim The Linux DEB/RPM scripts now ask the shim for the CopilotCliCommand policy before managing /usr/bin/copilot, matching Windows setup: a disabled policy removes a link to either edition's shim instead of creating one, and an unreadable policy leaves the entry unchanged. DEB packages add a preseedable <package>/add-copilot-command debconf question (medium priority, default true) that lets an edition opt out; hand-over on removal respects the other edition's answer and the policy. The shim gains `--vscode-shim policy`, which exits 0 when the policy allows the command and 10 when it turns it off, and reads the policy on macOS from the configuration-profile domains of every quality (ported from #341916). * test: drop rendering tests that only exercised the harness validator Keep the checks of the real link helper source and the DEB/RPM templates; the removed cases tested the package-lifecycle harness's own validator rather than product code. * copilot: bump the shim to 0.1.2 main's #342224 and this branch both changed the shim and bumped it from 0.1.0 to 0.1.1. Windows setup keeps a published shim whose file version matches, so the merged shim needs its own version to replace main's 0.1.1. --------- Co-authored-by: Karthik Nadig <[email protected]> Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes microsoft/vscode-internalbacklog#10108
Summary
Make the native Rust
copilotshim readCopilotCliCommandon macOS and Linux. A terminal opened before policy is disabled can retain the shim onPATH; previously the non-Windows reader always returned false, allowing a missing CLI to be offered for installation./etc/vscode/policy.jsonand recognizes only a JSON booleanfalse.CFBooleanvalues usingCFPreferencesCopyAppValuefor Stable, Insiders, Exploration, and OSS. A false value in any domain disables installation.10. The existing setupprobeandinstallcommands consume the same policy result.serde_json/core-foundation-sysdependencies and bump the shim to0.1.1as required for binary replacement. Retired script shims are unchanged.Prior patterns
CFPreferencesAppValueIsForced: fix: preserve macOS scalar policy behavior vscode-policy-watcher#79 restored effective-preference semantics for scalar policies, which is the current behavior this boolean policy must match.Validation
All commands below passed locally with Rust 1.88 on macOS unless otherwise noted.
cargo +1.88 test --manifest-path copilot_shim/Cargo.toml --lockedcargo +1.88 test --manifest-path copilot_shim/Cargo.toml --locked --lib policycargo +1.88 clippy --manifest-path copilot_shim/Cargo.toml --all-targets --locked -- -D warningscargo +1.88 fmt --manifest-path copilot_shim/Cargo.toml --checkcargo +1.88 build --manifest-path copilot_shim/Cargo.toml --release --locked --bin copilotcargo +1.88 check --manifest-path copilot_shim/Cargo.toml --target x86_64-unknown-linux-gnu --all-targets --lockedcargo +1.88 check --manifest-path copilot_shim/Cargo.toml --target x86_64-pc-windows-msvc --all-targets --lockedcargo +1.88 metadata --manifest-path copilot_shim/Cargo.toml --locked --no-deps --format-version 10.1.1npm run eslint -- src/vs/platform/agentHost/common/agentHostPolicySupport.tsgit diff --checkA temporary metadata-only probe including the actual policy source confirmed that the helper's formerly safe call now fails with
E0133, while an explicit unsafe call compiles. The probe was not executed and was removed afterward. The final repair received an independent read-only review with no findings.The branch was fast-forwarded to main before publication. The Rust package and all eight reviewed file contents remained unchanged, so their successful validation was retained.
Coverage limits
/etc/vscode/policy.jsonwas run.cfprefsdpropagation test was run on this developer machine.