Uh oh!
There was an error while loading. Please reload this page.
fix(@angular/cli): resolve executables strictly from PATH - #33758
fix(@angular/cli): resolve executables strictly from PATH#33758alan-agius4 wants to merge 2 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
12b5aa7 to
62cbca6Comparealan-agius4
commented
Aug 5, 2026
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a utility function findExecutableOnPath to safely resolve executables from the PATH environment variable, preventing implicit resolution from the current working directory on Windows. It integrates this utility when executing git and which. The review feedback highlights critical security and correctness improvements: avoiding fallback to bare command names ('git' and 'which') when they are not found on the PATH to prevent command injection risks, and stripping double quotes from PATH directory entries on Windows to correctly handle paths with spaces.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
62cbca6 to
e60ed21CompareUpdate executable invocation logic to resolve system binaries (such as `git` and `which`) strictly from the `PATH` environment variable. This prevents bare command names passed to `execFileSync` / `execFile` from implicitly searching and resolving binaries relative to `process.cwd()` on Windows. Fixesangular#33755
e60ed21 to
7d94382Comparebilguunbicktivism
commented
Aug 5, 2026
Thanks for turning this around so fast, and for picking up One small edge case on
A
One line covers it: constdir=rawDir.startsWith('"')&&rawDir.endsWith('"') ? rawDir.slice(1,-1) : rawDir;if(!isAbsolute(dir)){continue;}or Also agree with your framing on the issue itself: a workspace you have chosen to build in already executes project code through lifecycle scripts, builders and schematics, so this is defense in depth rather than a boundary. Thanks for treating it that way. |
alan-agius4
commented
Aug 5, 2026
Good call! Updated |
clydin
commented
Aug 5, 2026
Other tools don't do this and it seems quite complex with the mix of PATH/PATHEXT and multiple system calls. Are we sure this is a viable path forward? This can also break legitimate use cases like custom git shims or developer/project specific wrappers. If we were to do this, would it be better to try setting the |
bilguunbicktivism
commented
Aug 5, 2026
@clydin I think you're right, and it's checkable, so I measured it rather than argue. Windows 10.0.26200, Node v24.17.0, a plant Setting the variable from inside the running process works — it does not need to be inherited: Negative control, same runs against a directory with no plant: canary never fires and the real git answers, so the Three things that follow, and one of them is a foot-gun:
On your "custom git shims" concern — that cuts against this approach too, and more bluntly: the env var is process-global, so it disables working-directory resolution for every child the CLI spawns, whereas Happy to share the probe scripts if useful. |
Update executable invocation logic to resolve system binaries (such as
gitandwhich) strictly from thePATHenvironment variable.This prevents bare command names passed to
execFileSync/execFilefrom implicitly searching and resolving binaries relative toprocess.cwd()on Windows.Fixes#33755