From 75a657da7af875b2e2724fd6331bf0a4b23d3c9a Mon Sep 17 00:00:00 2001 From: Yeting Li Date: Sat, 11 Sep 2021 04:23:24 +0800 Subject: [PATCH] Fix potential ReDoS (#37) --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index c254480..9e37ec3 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ module.exports = options => { }, options); 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('|');