-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Mitigate Windows GH CLI command injection #1874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ export interface ProcessRunOptions { | |
| allowNonZeroExit?: boolean | undefined; | ||
| maxBufferBytes?: number | undefined; | ||
| outputMode?: "error" | "truncate" | undefined; | ||
| shell?: boolean | undefined; | ||
| } | ||
|
|
||
| export interface ProcessRunResult { | ||
|
|
@@ -139,7 +140,7 @@ export async function runProcess( | |
| cwd: options.cwd, | ||
| env: options.env, | ||
| stdio: "pipe", | ||
| shell: process.platform === "win32", | ||
| shell: options.shell ?? process.platform === "win32", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing parentheses in nullish coalescing expressionLow Severity The expression Reviewed by Cursor Bugbot for commit ce1b679. Configure here. |
||
| }); | ||
|
|
||
| let stdout = ""; | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shell:false breaks gh .cmd shims on Windows
Medium Severity
Setting
shell: falseforghinvocations on Windows prevents Node.jsspawnfrom executing.cmd/.batshims. Ifghis installed via a package manager that creates.cmdshims (rather than placinggh.exedirectly on PATH), the spawn call will fail withENOENT. The originalshell: trueon Windows existed precisely to handle this — the openai/codex repo itself has issue #16337 about this exact pattern. While mostghinstallations use.exe, this is a regression for some Windows setups.Reviewed by Cursor Bugbot for commit 1fd6244. Configure here.