Skip to content

Commit 1d4ffda

Browse files
authored
Merge pull request #4158 from ready-research/ReDoS
fix(security): fix ReDoS in Regex
2 parents bc3acb0 + ca617df commit 1d4ffda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface Paths {
2020

2121
// From https://github.com/chalk/ansi-regex
2222
const pattern = [
23-
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
23+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
2424
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))",
2525
].join("|")
2626
const re = new RegExp(pattern, "g")

0 commit comments

Comments
 (0)