Commit d55398f
node-cache - fix: prototype pollution vulnerability in mget methods (#1613)
* fix: prevent prototype pollution in node-cache mget()
Use Object.create(null) for mget() result objects in both NodeCache and
NodeCacheStore so that __proto__ keys are treated as plain properties
instead of polluting Object.prototype.
Fixes #1612
https://claude.ai/code/session_01MhMFGu517ERhcLM4M5DsM8
* fix: strengthen prototype pollution tests with own-property assertions
Replace result.__proto__ value check with Object.getPrototypeOf(result)
=== null and Object.hasOwn(result, "__proto__") assertions that actually
verify the Object.create(null) fix rather than passing vacuously.
https://claude.ai/code/session_01MhMFGu517ERhcLM4M5DsM8
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 487d6ff commit d55398f
File tree
4 files changed
+26
-2
lines changed- packages/node-cache
- src
- test
4 files changed
+26
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
271 | 274 | | |
272 | 275 | | |
273 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
122 | 125 | | |
123 | 126 | | |
124 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
75 | 84 | | |
76 | 85 | | |
77 | 86 | | |
| |||
0 commit comments