aboutsummaryrefslogtreecommitdiff
path: root/node_modules/is-url/test/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/is-url/test/index.js')
-rw-r--r--node_modules/is-url/test/index.js27
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');
+ });
});
});