Repository navigation
Commit ea7548f
fix: pin prototype-pollution test to a real malicious payload
CodeRabbit caught that the __proto__ regression guard was hollow:
JSON.stringify({__proto__: ...}) produces `{}` — `__proto__` in
object-literal syntax is the prototype setter, not an enumerable
own property, so it never makes it into the JSON. The test was
serializing an empty payload and asserting prototype wasn't
polluted (trivially true).
Replace the JSON.stringify call with a hand-written JSON literal
containing an explicit "__proto__" key. parseAPICallError's
JSON.parse now actually receives the malicious key, exercising
the regression guard against a future refactor that switches
to Object.assign / spread.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 724b114 commit ea7548f
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| |||
0 commit comments