Commit dca4fbb
committed
fix(package-manager): eliminate CWE-78 OS command injection across all Windows spawn paths
Five locations concatenated user-controlled arguments into a raw shell
string executed by cmd.exe (shell:true), allowing metacharacters such
as &, |, >, ^ in a package specifier or --package-manager flag to
inject and execute arbitrary OS commands silently alongside the
legitimate package manager process.
Affected paths and their fix:
- host.ts: shell:isWin32 + args.join concat replaced with cmd.exe
array invocation (shell:false) so Node.js controls arg quoting
- executor.ts: escapedArgs+string-concat pattern replaced with
cmd.exe direct array invocation; shell:true removed
- ssr-dev-server/utils.ts: args.join concat replaced with cmd.exe
array dispatch on Windows, safe array-form on POSIX
- ssr-dev-server/index.ts: stray shell:true removed from
spawnAsObservable call-site (platform dispatch in utils.ts)
- workspace/index.ts: ALLOWED_PKG_MANAGERS allowlist guard added
before execSync to block injection via ng new --package-manager
POSIX spawn paths (array-form, shell:false) are unchanged.
Follows pattern from #32678 which patched repo-init/executor.ts.
CWE: CWE-78 (OS Command Injection)1 parent 5f88d87 commit dca4fbb
File tree
1 file changed
+15
-10
lines changed- packages/angular_devkit/schematics/tasks/package-manager
1 file changed
+15
-10
lines changedLines changed: 15 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
178 | 183 | | |
179 | 184 | | |
180 | 185 | | |
| |||
0 commit comments