Private/waabusea/switchgh token#8602
Open
WaelAbuSeada wants to merge 3 commits into
Open
Conversation
| $val = [System.Environment]::GetEnvironmentVariable($key) | ||
| if ($val) { $cleanEnv[$key] = $val } | ||
| } | ||
| $cleanEnv['GH_TOKEN'] = $CopilotToken |
Contributor
There was a problem hiding this comment.
Subprocess receives over-privileged token
The GITHUB_TOKEN passed as GH_TOKEN to the Copilot CLI subprocess carries pull-requests: write and issues: write permissions that the CLI needs only copilot-requests: write for. If the CLI process were compromised or behaved unexpectedly, it could modify PR/issue data using those extra scopes.
Recommendation:
- This is an inherent limitation of the GitHub Actions token model (sub-tokens with reduced scopes cannot be minted), but the risk should be acknowledged in the code comment. Ensure the Copilot CLI version is pinned to a verified release to reduce the blast radius of a supply-chain compromise.
Suggested change
| $cleanEnv['GH_TOKEN'] = $CopilotToken | |
| # Pass only a safe allowlist of env vars to the subprocess. | |
| # NOTE: GH_TOKEN carries full workflow permissions (pull-requests: write, | |
| # issues: write, copilot-requests: write). GitHub Actions cannot mint a | |
| # narrower sub-token, so pin the Copilot CLI version to a verified release. | |
| $cleanEnv['GH_TOKEN'] = $GithubToken |
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why
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.
Switch gh copilot CLI to built-in auth
Fixes AB#638509