Add copilot PowerShell wrapper that pre-approves safe file writes - #638
Draft
DevSecNinja with Copilot wants to merge 2 commits into
Draft
Add copilot PowerShell wrapper that pre-approves safe file writes#638DevSecNinja with Copilot wants to merge 2 commits into
copilot PowerShell wrapper that pre-approves safe file writes#638DevSecNinja with Copilot wants to merge 2 commits into
Conversation
Open
6 tasks
Copilot
AI
changed the title
[WIP] Add copilot PowerShell wrapper for safe file writes
Add Jul 29, 2026
copilot PowerShell wrapper that pre-approves safe file writes
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.
Every file create/edit in Copilot CLI triggers a manual accept prompt, even in trusted, git-tracked repos where
git diff/git restorealready provide a safety net. This adds acopilotPowerShell wrapper that pre-approves file writes only, leaving shell and MCP tools gated.Changes
Invoke-Copilotfunction (Public/Copilot.ps1): resolves the realcopilotexecutable viaGet-Command -CommandType Application(never itself, avoiding alias recursion) and invokes it with--allow-tool=<list>prepended.write(file create/edit only).$env:COPILOT_ALLOW_TOOLS, so it can be widened (e.g. read-onlygit status/git diff) or narrowed without editing the function.-Rawswitch bypasses pre-approval entirely as an escape hatch.copilotisn't found on PATH.copilotalias added inaliases.ps1pointing toInvoke-Copilot; function registered inDotfilesHelpers.psd1FunctionsToExport, matching the existingConnect-CopilotSshpattern.docs/copilot-cli.md, clarifying this is independent from the existing bash/zsh/fish 1Password shell-plugin wrapper.-Rawbypass, and missing-CLI error handling using a PATH-stubbedcopilotexecutable.copilotPowerShell wrapper that pre-approves safe file writes (--allow-tool='write') #637