Commit 6a86cd3
committed
fix(store): prevent prototype pollution via setStore paths
Reject writes to `__proto__` in `setProperty` and refuse to traverse
through `__proto__`, `constructor`, and `prototype` in `updatePath`.
This closes a prototype-pollution vector where attacker-controlled
path segments (e.g. from query params, form data, or a JSON payload
merged via `setStore(obj)`) could reach and mutate `Object.prototype`
or `Function.prototype` globally.
Covers all mutation entry points that funnel through `setProperty`:
`createStore` / `setStore`, `createMutable` (proxy set trap),
`produce` (setterTraps), `reconcile`, and `mergeStoreNode`.
Adds regression tests for each reachable pollution path.1 parent 7d913a6 commit 6a86cd3
2 files changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
| |||
274 | 281 | | |
275 | 282 | | |
276 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
277 | 299 | | |
278 | 300 | | |
279 | 301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
799 | 799 | | |
800 | 800 | | |
801 | 801 | | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
802 | 829 | | |
803 | 830 | | |
804 | 831 | | |
| |||
0 commit comments