Skip to content

Fix ReDoS issue #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix ReDoS issue #1

wants to merge 1 commit into from

Conversation

pclinger
Copy link

Hello,

There is a Regex Denial of Service (ReDoS) that this PR fixes.

(?:\\.|[^\]\\]*)* can be simplified to (?:\\.|[^\]\\])* which resolves the issue.

You can check the original and updated regex using this ReDoS checker:

original: /^\/(?=[^*/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuys]*/
fixed: /^\/(?=[^*/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\])*\])[^[\\/]*)*?\/[gimuys]*/

Example that causes the problem:

/^\/(?=[^*/])[^[/\\]*(?:(?:\\.|\[(?:\\.|[^\]\\]*)*\])[^[\\/]*)*?\/[gimuys]*/.test('/[[/g][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][gg][g')

Thank you for your consideration.

@aMarCruz
Copy link
Owner

Thanks @pclinger ,
as soon as possible I will review this PR.

@pclinger
Copy link
Author

Hello @aMarCruz, please let me know if you have any questions about this PR. Thank you!

@pclinger
Copy link
Author

Hello @aMarCruz just following up on this one. Thank you

@pclinger
Copy link
Author

Hello again @aMarCruz, just wanted to followup on this PR if you can review & merge.

@pclinger
Copy link
Author

pclinger commented Nov 6, 2024

Hello @aMarCruz, just wanted to followup on this fix. Please let me know if there is anything I can do to help get this merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants