Repository navigation
Commit 8acbe42
docs(mcp): correct the safeCopy comment — unsafe keys are DROPPED, not rescued
PR #31 review (Copilot), documentation accuracy. The safeCopy JSDoc said it
"stops a key legitimately named __proto__ from silently vanishing into a setter,"
which reads as if such a key is preserved. It is not: the loop `continue`s on
__proto__/constructor/prototype, dropping them outright. The behavior is correct
(dropping is the safe choice, and such a name is meaningless as an env var and
unused as a top-level JSON-Schema keyword); only the comment mis-described it.
Reworded to say plainly that those keys are dropped, never copied, and that this
is a drop rather than a rescue — with the one-line rationale for why losing them
costs nothing.
Also strengthened the existing TRUST test to match the now-accurate contract: it
asserts up front that the input genuinely carries own __proto__/constructor keys
(so the drop path is provably exercised, not vacuous) and that they do not appear
in the output. Mutation-checked: removing the `continue` (i.e. copying the keys
through) fails the test. Full gate: 18 suites, 0 failures.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 8ccb47d commit 8acbe42
2 files changed
Lines changed: 21 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | | - | |
| 83 | + | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | | - | |
111 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
113 | 120 | | |
114 | 121 | | |
115 | 122 | | |
116 | | - | |
117 | | - | |
| 123 | + | |
| 124 | + | |
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
| |||
0 commit comments