Skip to content

Commit 3dbebff

Browse files
shadowspawnljharb
authored andcommitted
[Tests] check side-effects of pollution protection
1 parent 34e20b8 commit 3dbebff

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/proto.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ var test = require('tape');
55

66
/* eslint no-proto: 0 */
77

8+
// Not pollution as such, but verify protections working as intended.
9+
test('trailing __proto__ key in dotted option ignored', function (t) {
10+
var argv = parse(['--a.__proto__', 'IGNORED']);
11+
t.deepEqual(argv.a, {});
12+
t.end();
13+
});
14+
15+
// Not pollution as such, but verify protections working as intended.
16+
test('trailing constructor key in dotted option ignored', function (t) {
17+
var argv = parse(['--a.constructor', 'IGNORED']);
18+
t.deepEqual(argv.a, {});
19+
t.end();
20+
});
21+
822
test('proto pollution', function (t) {
923
var argv = parse(['--__proto__.x', '123']);
1024
t.equal({}.x, undefined);

0 commit comments

Comments
 (0)