Skip to content

Commit

Permalink
test: check for prototype pollution
Browse files Browse the repository at this point in the history
  • Loading branch information
ssong committed Jun 22, 2022
1 parent 93e99c9 commit ed23d74
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/spec/object/spec-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ define(
expect( o.foo ).toEqual( 'bar' );
});

it('should be safe from prototype pollution', function () {
var o = {};
var payload = JSON.parse('["constructor.prototype.polluted"]');
set(o, payload, 'bar');
expect( o.polluted ).toEqual( undefined );
});

});

}
Expand Down

0 comments on commit ed23d74

Please sign in to comment.