Blob Blame History Raw
From 03704852379d943e3252f6bfa5978d5485b8b10b Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 13 Dec 2021 12:18:27 +0100
Subject: [PATCH] dep(ansi-regex): fix potential ReDoS

This is application of upstream patch [1] to all bundled deps.

[1]: https://github.com/chalk/ansi-regex/commit/8d1d7cdb586269882c4bdc1b7325d0c58c8f76f9

Fixes: CVE-2021-3807
Signed-off-by: rpm-build <rpm-build>
---
 node_modules/ansi-align/node_modules/ansi-regex/index.js  | 2 +-
 node_modules/boxen/node_modules/ansi-regex/index.js       | 2 +-
 node_modules/widest-line/node_modules/ansi-regex/index.js | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/node_modules/ansi-align/node_modules/ansi-regex/index.js b/node_modules/ansi-align/node_modules/ansi-regex/index.js
index c254480..f4d035c 100644
--- a/node_modules/ansi-align/node_modules/ansi-regex/index.js
+++ b/node_modules/ansi-align/node_modules/ansi-regex/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('|');
 
diff --git a/node_modules/boxen/node_modules/ansi-regex/index.js b/node_modules/boxen/node_modules/ansi-regex/index.js
index 35054aa..624d38b 100644
--- a/node_modules/boxen/node_modules/ansi-regex/index.js
+++ b/node_modules/boxen/node_modules/ansi-regex/index.js
@@ -2,7 +2,7 @@
 
 module.exports = ({onlyFirst = false} = {}) => {
 	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('|');
 
diff --git a/node_modules/widest-line/node_modules/ansi-regex/index.js b/node_modules/widest-line/node_modules/ansi-regex/index.js
index 35054aa..624d38b 100644
--- a/node_modules/widest-line/node_modules/ansi-regex/index.js
+++ b/node_modules/widest-line/node_modules/ansi-regex/index.js
@@ -2,7 +2,7 @@
 
 module.exports = ({onlyFirst = false} = {}) => {
 	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('|');
 
-- 
2.33.1