Skip to content

Commit

Permalink
fix(test): more prototype pollution tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Sep 15, 2020
1 parent 604f112 commit f769030
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/suites/pollution.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default function (klona) {

assert.notEqual(({})['a0'], true, 'Safe POJO');
assert.notEqual(new Object()['a0'], true, 'Safe Object');
assert.notEqual(Object.create(null)['a0'], true, 'Safe dictionary');
assert.notEqual(Object.create(Object.prototype)['a0'], true, 'Safe prototype');

assert.notEqual(input['a0'], true, 'Safe input');
assert.notEqual(output['a0'], true, 'Safe output');
Expand All @@ -36,9 +38,8 @@ export default function (klona) {

assert.notEqual(({})['a0'], true, 'Safe POJO');
assert.notEqual(new Object()['a0'], true, 'Safe Object');

assert.notEqual(input['a0'], true, 'Safe input');
assert.notEqual(output['a0'], true, 'Safe output');
assert.notEqual(Object.create(null)['a0'], true, 'Safe dictionary');
assert.notEqual(Object.create(Object.prototype)['a0'], true, 'Safe prototype');
});

Pollution('prototype', () => {
Expand All @@ -53,6 +54,8 @@ export default function (klona) {

assert.notEqual(({})['hello'], 'world', 'Safe POJO');
assert.notEqual(new Object()['hello'], 'world', 'Safe Object');
assert.notEqual(Object.create(null)['hello'], 'world', 'Safe dictionary');
assert.notEqual(Object.create(Object.prototype)['hello'], 'world', 'Safe prototype');

assert.notEqual(input['hello'], 'world', 'Safe input');
assert.notEqual(output['hello'], 'world', 'Safe output');
Expand Down

0 comments on commit f769030

Please sign in to comment.