From ca617df135e78833f93c8320cb2d2cf8bba809f5 Mon Sep 17 00:00:00 2001 From: ready-research <72916209+ready-research@users.noreply.github.com> Date: Sat, 11 Sep 2021 18:40:47 +0530 Subject: [PATCH] [Security] Fix ReDoS Fix potential ReDoS --- src/node/util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node/util.ts b/src/node/util.ts index 1216601ef..61e410be5 100644 --- a/src/node/util.ts +++ b/src/node/util.ts @@ -20,7 +20,7 @@ export interface Paths { // From https://github.com/chalk/ansi-regex const pattern = [ - "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", ].join("|") const re = new RegExp(pattern, "g")