Skip to content

Commit 9a9226c

Browse files
nonaraRon S
authored and
Ron S
committed
test: Added test for prototype pollution (closes #129)
1 parent d462e44 commit 9a9226c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/129.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { parse } = require('../dist');
2+
3+
// see: https://github.com/taoqf/node-html-parser/issues/129
4+
describe('Prototype pollution', () => {
5+
it('prevents prototype pollution', () => {
6+
const root = parse('<a href="#" __proto__="polluted=true">');
7+
should(root.firstChild.attributes.polluted).not.be.ok();
8+
should(root.firstChild.attributes.hasOwnProperty('proto__')).be.ok();
9+
});
10+
});

0 commit comments

Comments
 (0)