Commit 5009715
fix: reject spoofed RegExp objects with non-string source property
A fake RegExp created via Object.create(RegExp.prototype) passes
instanceof RegExp but can supply an object as .source. That object
survives serialize() as executable JS and runs when the consumer
evaluates new RegExp(obj, flags) via toString() coercion. Guard
mirrors the existing URL fix: assert typeof source === 'string'
and throw TypeError otherwise.
Fixes: PSECBUGS-112938
Fixes: PSECBUGS-108887
PR-URL: #222
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 153eb43 commit 5009715
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
263 | 267 | | |
264 | 268 | | |
265 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 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 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
319 | 354 | | |
320 | 355 | | |
321 | 356 | | |
| |||
0 commit comments