From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/is-url/test/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'node_modules/is-url/test/index.js') 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'); + }); }); }); -- cgit v1.2.3