diff --git a/CHANGELOG.md b/CHANGELOG.md index aa8dc3b..ce9ef27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Normalize `git://` repository URLs for Discord links in `npm` command - Optimize `run` command and expand its judge0 language alias map - Harden `http` command against SSRF and DoS +- Fix reDoS risk from unrestricted user-controlled RegExp ### Contributors @@ -42,7 +43,7 @@ - **Security Auditing**: Embedded a URL inspection utility to evaluate links for potential safety risks. - **Community-Tier Access**: Implemented a server-membership verification system to seamlessly unlock premium commands for community supporters. -### contributors +### Contributors - [@calebephrem](https://github.com/calebephrem) - [@joshdegr8](https://github.com/joshdegr8) diff --git a/src/commands/tools/regex.ts b/src/commands/tools/regex.ts index 695205f..e6561c9 100644 --- a/src/commands/tools/regex.ts +++ b/src/commands/tools/regex.ts @@ -76,12 +76,15 @@ function matchWithTimeout( finish(() => reject(new Error("timeout"))); }, timeoutMs); - worker.on("message", (msg: { ok: boolean; results?: MatchResult[]; error?: string }) => { - finish(() => { - if (msg.ok) resolve(msg.results ?? []); - else reject(new Error(msg.error || "regex error")); - }); - }); + worker.on( + "message", + (msg: { ok: boolean; results?: MatchResult[]; error?: string }) => { + finish(() => { + if (msg.ok) resolve(msg.results ?? []); + else reject(new Error(msg.error || "regex error")); + }); + }, + ); worker.on("error", (err) => { finish(() => reject(err));