diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/is-url/test/index.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/is-url/test/index.js')
-rw-r--r-- | node_modules/is-url/test/index.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/is-url/test/index.js b/node_modules/is-url/test/index.js index 5f7aebce1..404e1b6f0 100644 --- a/node_modules/is-url/test/index.js +++ b/node_modules/is-url/test/index.js @@ -118,5 +118,32 @@ describe('is-url', function () { it('google.com', function () { assert(!url('google.com')); }); + + it('empty', function () { + assert(!url('')); + }); + + it('undef', function () { + assert(!url(undefined)); + }); + + it('object', function () { + assert(!url({})); + }); + + it('re', function () { + assert(!url(/abc/)); + }); + }); + + describe('redos', function () { + it('redos exploit', function () { + // Invalid. This should be discovered in under 1 second. + var attackString = 'a://localhost' + '9'.repeat(100000) + '\t'; + var before = process.hrtime(); + assert(!url(attackString), 'attackString was valid'); + var elapsed = process.hrtime(before); + assert(elapsed[0] < 1, 'attackString took ' + elapsed[0] + ' > 1 seconds'); + }); }); }); |