From bf39500712255e9a914a8f90574c11491d1f9cb1 Mon Sep 17 00:00:00 2001 From: ready-research <72916209+ready-research@users.noreply.github.com> Date: Thu, 7 Oct 2021 18:34:10 +0530 Subject: [PATCH] [Security] Fix ReDoS (#333) Fix potential ReDoS --- lib/util/strip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util/strip.js b/lib/util/strip.js index 68d15df6..8ebf4cb1 100644 --- a/lib/util/strip.js +++ b/lib/util/strip.js @@ -2,7 +2,7 @@ module.exports = str => { 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('|');