Skip to content

Commit

Permalink
Fix potential ReDoS (chalk#37)
Browse files Browse the repository at this point in the history
This is a backport of chalk@8d1d7cd

the test suite on the 3.0.0 branch is broken but I've manually verified
that no additional tests are broken and that this patch fixes the REDOS
  • Loading branch information
MylesBorins committed Nov 3, 2021
1 parent 0a8cc19 commit f006995
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -2,7 +2,7 @@

module.exports = () => {
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('|');

Expand Down

0 comments on commit f006995

Please sign in to comment.