Sha256: df8a4109190c18536003eab1192365fa88d50f184970c687193e003b73937aa0

Contents?: true

Size: 1.2 KB

Versions: 91

Compression:

Stored size: 1.2 KB

Contents

var parse = require('../');
var test = require('tape');

test('proto pollution', function (t) {
    var argv = parse(['--__proto__.x','123']);
    t.equal({}.x, undefined);
    t.equal(argv.__proto__.x, undefined);
    t.equal(argv.x, undefined);
    t.end();
});

test('proto pollution (array)', function (t) {
    var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']);
    t.equal({}.z, undefined);
    t.deepEqual(argv.x, [4,5]);
    t.equal(argv.x.z, undefined);
    t.equal(argv.x.__proto__.z, undefined);
    t.end();
});

test('proto pollution (number)', function (t) {
    var argv = parse(['--x','5','--x.__proto__.z','100']);
    t.equal({}.z, undefined);
    t.equal((4).z, undefined);
    t.equal(argv.x, 5);
    t.equal(argv.x.z, undefined);
    t.end();
});

test('proto pollution (string)', function (t) {
    var argv = parse(['--x','abc','--x.__proto__.z','def']);
    t.equal({}.z, undefined);
    t.equal('...'.z, undefined);
    t.equal(argv.x, 'abc');
    t.equal(argv.x.z, undefined);
    t.end();
});

test('proto pollution (constructor)', function (t) {
    var argv = parse(['--constructor.prototype.y','123']);
    t.equal({}.y, undefined);
    t.equal(argv.y, undefined);
    t.end();
});

Version data entries

91 entries across 55 versions & 9 rubygems

Version Path
boring_generators-0.15.0 tmp/templates/app_template/node_modules/minimist/test/proto.js
boring_generators-0.14.0 tmp/templates/app_template/node_modules/minimist/test/proto.js
optimacms-0.1.61 spec/dummy/node_modules/minimist/test/proto.js
boring_generators-0.13.0 tmp/templates/app_template/node_modules/minimist/test/proto.js
boring_generators-0.12.0 tmp/templates/app_template/node_modules/minimist/test/proto.js
trusty-cms-5.0.7 node_modules/minimist/test/proto.js
trusty-cms-5.0.6 node_modules/minimist/test/proto.js
trusty-cms-5.0.5 node_modules/minimist/test/proto.js
trusty-cms-5.0.4 node_modules/minimist/test/proto.js
disco_app-0.16.1 test/dummy/node_modules/file-loader/node_modules/minimist/test/proto.js
disco_app-0.16.1 test/dummy/node_modules/@babel/core/node_modules/minimist/test/proto.js
disco_app-0.16.1 test/dummy/node_modules/portfinder/node_modules/minimist/test/proto.js
disco_app-0.16.1 test/dummy/node_modules/sass-loader/node_modules/minimist/test/proto.js
disco_app-0.16.1 test/dummy/node_modules/webpack/node_modules/minimist/test/proto.js
disco_app-0.16.1 test/dummy/node_modules/style-loader/node_modules/minimist/test/proto.js
disco_app-0.15.2 test/dummy/node_modules/sass-loader/node_modules/minimist/test/proto.js
disco_app-0.15.2 test/dummy/node_modules/style-loader/node_modules/minimist/test/proto.js
disco_app-0.15.2 test/dummy/node_modules/webpack/node_modules/minimist/test/proto.js
disco_app-0.15.2 test/dummy/node_modules/@babel/core/node_modules/minimist/test/proto.js
disco_app-0.15.2 test/dummy/node_modules/portfinder/node_modules/minimist/test/proto.js