Repository navigation
Commit 2e1bbcb
committed
fix(webview): reject encoded traversal separators and pin mention/link overlap
Thread triage on #1763 (edelauna @02:18:43Z):
1. The "fully inside or outside" claim is real: the mention regex's path
branch runs to the next whitespace, so @/src/a.ts[link](x) matches
[0,19] while the link node masks only [10,19] - a partial overlap where
some() and every() disagree (some discards; every keeps and would
swallow the link syntax into the placeholder). The Stryker directive
claiming equivalence is removed, the comment states the touch rule,
and a new test pins the shipped behavior (link preserved, mention inert)
so the some->every mutant is killed (NC verified).
2. Guard test inputs: added src/../../.env (kills a first-segment-only
check), ../x.ts:12 (pins traversal refusal after the line anchor is
stripped), and a backslash case. The backslash case exposed a real gap:
react-markdown's URL transform percent-encodes the backslash to %5C
before the guard runs, so a backslash traversal reached openFile as
./..%5C..%5C.env. The guard now also splits on the encoded separator
(case-insensitive); NC verified a slash-only split reddens the test.
Proofs: MarkdownBlock.spec 54/54; NC some->every reddens the overlap test,
slash-only split reddens the backslash test, first-segment-only reddens the
mid-path test (restored byte-exact); eslint --max-warnings=0 clean on both
files; prettier clean.1 parent 3ab830a commit 2e1bbcb
2 files changed
Lines changed: 67 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
585 | 588 | | |
586 | 589 | | |
587 | 590 | | |
588 | | - | |
589 | | - | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
590 | 595 | | |
591 | 596 | | |
592 | 597 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
494 | 511 | | |
495 | 512 | | |
496 | 513 | | |
| |||
695 | 712 | | |
696 | 713 | | |
697 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
698 | 756 | | |
699 | 757 | | |
700 | 758 | | |
| |||
0 commit comments