Commit 1964cb1
LOC-6805: allowlist option keys forwarded to the BrowserStackLocal binary
addArgs() prefixed ANY unrecognised key in the caller-supplied options
object with '--' and pushed it, with its value, onto the daemon argv. Any
caller — or upstream code merging untrusted input into options — could
inject arbitrary flags into the native binary (CWE-88).
Only documented BrowserStackLocal modifiers are forwarded now. The
allowlist mirrors the binary's own CLI definition (COMMAND_CONFIGURATION
in browserStackTunnel), long names and aliases, so every documented
modifier without an explicit switch case — localProxyHost/Port/User/Pass,
pac-file, custom-repeater, bs-host — keeps working.
Also refused:
- daemon / log-file / source, which getBinaryArgs() sets itself, so a
caller cannot append a conflicting second copy (e.g. '--daemon stop'
after our '--daemon start')
- a value beginning with '-'. The binary's parser does not consume such a
value, it reads it as another flag, so a legitimate key could still
smuggle one in. These values are already mis-parsed today, so this is
not a regression.
- onlyCommand, a wrapper-internal key, no longer leaks into the argv.
addArgs returns a LocalError, delivered through the existing paths:
callback(err) for start(), returned for startSync().
Closes the entry step of chain C-008. LOC-6790 (binarypath traversal) and
LOC-6777 (no binary integrity check) are unaffected and remain open — the
chain description's claim that this gates binarypath is inaccurate, that
value is an explicit switch case.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 0d29261 commit 1964cb1
3 files changed
Lines changed: 167 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
12 | 66 | | |
13 | 67 | | |
14 | 68 | | |
| |||
30 | 84 | | |
31 | 85 | | |
32 | 86 | | |
33 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
34 | 90 | | |
35 | 91 | | |
36 | 92 | | |
| |||
83 | 139 | | |
84 | 140 | | |
85 | 141 | | |
86 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
87 | 145 | | |
88 | 146 | | |
89 | 147 | | |
| |||
245 | 303 | | |
246 | 304 | | |
247 | 305 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
255 | 310 | | |
256 | 311 | | |
| 312 | + | |
257 | 313 | | |
258 | 314 | | |
259 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
260 | 346 | | |
261 | 347 | | |
262 | 348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
131 | 139 | | |
132 | 140 | | |
133 | 141 | | |
134 | 142 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
141 | 201 | | |
142 | 202 | | |
143 | 203 | | |
| |||
0 commit comments