From 8bac4eed4323efe5b5fb9acf49532c33dab58788 Mon Sep 17 00:00:00 2001 From: ready-research <72916209+ready-research@users.noreply.github.com> Date: Sat, 11 Sep 2021 13:49:52 +0530 Subject: [PATCH] [Security]Fix potential ReDoS Fix potential ReDoS --- lib/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.js b/lib/util.js index 90f9b7e..eca8e25 100644 --- a/lib/util.js +++ b/lib/util.js @@ -30,7 +30,7 @@ function partition(event) { // regex from https://github.com/chalk/ansi-regex const 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-PRZcf-ntqry=><~]))", ].join("|");