Commit 9ac2eb8
committed
Fix CWE-78 OS Command Injection in react-devtools editor.js
- Add SHELL_METACHARACTERS_RE to reject paths and editor binaries
containing shell operators (&, |, ;, etc.) before they reach
cmd.exe /C on Windows, preventing OS command injection.
- Parse VISUAL/EDITOR env vars through shell-quote parse() consistent
with how REACT_EDITOR is already handled, neutralising metacharacters
in those values before they are used as the spawned editor binary.
- Validate maybeRelativePath in getValidFilePath (line 116 entry point)
so injected paths are rejected before reaching launchEditor.
Resolves: CWE-78 (Improper Neutralization of Special Elements used in
an OS Command)1 parent f8b8507 commit 9ac2eb8
1 file changed
+24
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
| |||
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
101 | 107 | | |
102 | | - | |
| 108 | + | |
103 | 109 | | |
104 | | - | |
| 110 | + | |
105 | 111 | | |
106 | 112 | | |
107 | 113 | | |
| |||
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
119 | 133 | | |
120 | 134 | | |
121 | 135 | | |
| |||
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
164 | 185 | | |
165 | 186 | | |
166 | 187 | | |
| |||
0 commit comments