mirror of
https://github.com/CorentinTh/it-tools.git
synced 2026-08-28 04:49:41 +00:00
fix: replace remaining ReDoS-vulnerable regex in JS minify
Change `\/\/.*$/gm` to `\/\/[^\n]*/g` to avoid backtracking with `.*` and `$` anchor in multiline mode. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
70d0b20ac1
commit
e2e7d39cf1
1 changed files with 1 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ function minifyCss(input: string): string {
|
|||
function minifyJs(input: string): string {
|
||||
return input
|
||||
.replace(/\/\*[\s\S]*?\*\//g, '')
|
||||
.replace(/\/\/.*$/gm, '')
|
||||
.replace(/\/\/[^\n]*/g, '')
|
||||
.replace(/\s+/g, ' ')
|
||||
.replace(/ ?([{}();,=:+\-*/<>!&|?]) ?/g, '$1')
|
||||
.trim();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue