-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[Security] Fix ReDoS #1164
[Security] Fix ReDoS #1164
Conversation
Fix ReDoS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a test
done here: #1169 |
Please validate the above huntr link using |
Hi @jsdevel , could you give an update on when this might be merged. This has an impact on our project. |
@ready-research @aartichella i need a test added with this change and the build needs to pass. |
@jsdevel - A test was already merged from #1177 / #1169. Just need to merge the fix itself and respond to @ready-research to "mark as valid" in their form. |
@ready-research please rebase/get the build to pass. |
Hi All, Provided links on PRs do not contain any test, so I don't really get it. |
Odd, I really thought the mentioned PR(s) really provided a test. @w666 -- what kind of test and in which file would be suitable for this? I could maybe look into creating a test, but I am not at all an expert here. Does |
Hi @smokhov, I looked on this PR again, then on the example code provided on the I will investigate this CVE when I have time, but at this point there is not enough evidence. Please correct me if I am wrong. Example below: first is not fixed code, then provided fix |
It grows consistently from your samples. The fixed code's lowest 308/395 ms is 23% improvement. The other two are more significant 33-37%. It is possible it were worse before #1177 were merged? The higher you go is where it becomes more problematic (assuming busy environments with lots calls, but tbf I am not sure how prevalent those are to be DoS'ed...). Overall, however, the fix is an improvement in runtime, if a proper test is provided, IMO it should be merged, but otherwise will leave it up to you to make the final determination. |
Okay, looked into it, provided description and the example on The real redos issue looks like this let regexp = /^(\d+)*$/;
let str = "012345678901234567890123456789z";
console.log(regexp.test(str)); it consumes 100% cpu and runs for a very long time. |
Description for this PR should be like
|
I think files in Will keep this PR open for a bit, just in case. |
I had to revert this commit because it there was an error in the regex, somehow missed that. |
Fix ReDoS
Reported in https://www.huntr.dev/bounties/423e2208-6064-4150-b6f5-22f15f540259/, you can access this using GitHub.
Please validate using
Mark as valid
and alsoconfirm the fix
. Thank you.Update:
This does not fix ReDoS, more over issue was not confirmed at least against Node.js 20. Though it does improve performance.
Correct description for this change is