We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eabd71f commit 4e73d31Copy full SHA for 4e73d31
test/index.js
@@ -106,6 +106,25 @@ test('constructor :: pollution', t => {
106
});
107
108
109
+test('prototype :: pollution', t => {
110
+ const payload = '{"__proto__":{"a0":true}}';
111
+
112
+ const input = JSON.parse(payload);
113
+ const output = klona(input);
114
115
+ t.deepEqual(
116
+ JSON.stringify(output),
117
+ payload
118
+ );
119
120
+ t.not(({})['a0'], true, 'Safe POJO');
121
+ t.not(input['a0'], true, 'Safe input');
122
+ t.not(output['a0'], true, 'Safe output');
123
124
+ t.end();
125
+});
126
127
128
test('date', t => {
129
const input = new Date;
130
const output = klona(input);
0 commit comments