Commit 8dd0591
authored
The recursive own-property scan walked the entire reachable graph on
every bridge crossing. For host libraries returning objects with deep
cross-references (e.g. DOM wrappers with ownerDocument back-pointers),
this caused ~175x slowdown per the reproduction in #564.
Replace the recursive scan with a shallow scan of direct own-property
descriptors. Nested host objects are independently scanned when they
themselves cross the bridge, so the existing layered descriptor-extraction
attacks (covered by the depth-2 and depth-3 nested attack tests) remain
blocked at the layer where the Function constructor is exposed at depth 1.
Adds a regression test that builds a 1000-node cross-referenced graph and
asserts the bridge crossing completes under 2s; the unfixed code takes
~8s on the same machine.
Reported by @bglick. Fixes #564.
1 parent cdeb688 commit 8dd0591
3 files changed
Lines changed: 65 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
1058 | | - | |
| 1058 | + | |
1059 | 1059 | | |
1060 | 1060 | | |
1061 | 1061 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
552 | 569 | | |
553 | 570 | | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | 571 | | |
559 | 572 | | |
560 | 573 | | |
| |||
573 | 586 | | |
574 | 587 | | |
575 | 588 | | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
| 589 | + | |
| 590 | + | |
581 | 591 | | |
582 | 592 | | |
583 | 593 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
408 | 408 | | |
409 | 409 | | |
410 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
411 | 451 | | |
412 | 452 | | |
413 | 453 | | |
| |||
0 commit comments