Skip to content

Commit

Permalink
add test for ReDoS
Browse files Browse the repository at this point in the history
Signed-off-by: Outsider <outsideris@gmail.com>
  • Loading branch information
outsideris committed Nov 23, 2022
1 parent 0a10ddc commit 7dc6da7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/unit/utils.spec.js
Expand Up @@ -142,6 +142,12 @@ describe('lib/utils', function () {
var fn = '() => foo()';
expect(utils.clean(fn), 'to be', 'foo()');
});

it('should prevent ReDoS attack', function () {
this.timeout(100);
var attackFn = 'function' + ' '.repeat(20000);
expect(utils.clean(attackFn), 'to be', 'function');
});
});

describe('stringify()', function () {
Expand Down

0 comments on commit 7dc6da7

Please sign in to comment.