Commit 8eebf08
committed
fix(mcp): cover the remaining prototype-name mutation and doctor paths
The own-property gate only covered unscoped removal and getMcpConfigByName.
The scoped paths still used bare lookups:
- removeMcpConfig's project/user/local existence checks accepted inherited
members, so 'mcp remove constructor -s user' reported a successful removal
while leaving the configuration untouched;
- addMcpConfig's already-exists checks rejected valid 'mcp add constructor';
- doctor's servers[name] and activeServers[name] fabricated definitions for
prototype names.
Gate all of them on Object.hasOwn. Also reject the name '__proto__' at add
time: it passes the character check but assigning it on a plain object hits
the prototype setter instead of creating an own property, so the server
would be reported as added and silently vanish.
Restore NODE_ENV in the test teardown alongside the config state.1 parent 328f621 commit 8eebf08
3 files changed
Lines changed: 60 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
47 | 59 | | |
48 | 60 | | |
49 | 61 | | |
| |||
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
636 | 643 | | |
637 | 644 | | |
638 | 645 | | |
| |||
682 | 689 | | |
683 | 690 | | |
684 | 691 | | |
685 | | - | |
| 692 | + | |
686 | 693 | | |
687 | 694 | | |
688 | 695 | | |
689 | 696 | | |
690 | 697 | | |
691 | 698 | | |
692 | | - | |
| 699 | + | |
693 | 700 | | |
694 | 701 | | |
695 | 702 | | |
696 | 703 | | |
697 | 704 | | |
698 | 705 | | |
699 | | - | |
| 706 | + | |
700 | 707 | | |
701 | 708 | | |
702 | 709 | | |
| |||
774 | 781 | | |
775 | 782 | | |
776 | 783 | | |
777 | | - | |
| 784 | + | |
778 | 785 | | |
779 | 786 | | |
780 | 787 | | |
| |||
799 | 806 | | |
800 | 807 | | |
801 | 808 | | |
802 | | - | |
| 809 | + | |
803 | 810 | | |
804 | 811 | | |
805 | 812 | | |
| |||
815 | 822 | | |
816 | 823 | | |
817 | 824 | | |
818 | | - | |
| 825 | + | |
819 | 826 | | |
820 | 827 | | |
821 | 828 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
244 | 247 | | |
245 | 248 | | |
246 | 249 | | |
| |||
540 | 543 | | |
541 | 544 | | |
542 | 545 | | |
543 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
544 | 549 | | |
545 | 550 | | |
546 | 551 | | |
| |||
0 commit comments