-
Notifications
You must be signed in to change notification settings - Fork 40
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 vulnerability #18
Conversation
Problem: As disclosed by email, the regex in this module was vulnerable to catastrophic backtracking. This could be used as a REDOS vector for Node.js servers that use this module. Solution: Use a two-step validation process. Split the vulnerable regex into three safe ones.
Credit to @josdejong for spotting this. |
👍 |
From Travis:
Default config is for a ruby project. I wonder how Travis ever worked on this repo... 🤔 This project is using a special combination of To be on the safe side, I would recommend doing a major version bump to avoid breaking any existing users. However that means users won't get this security fix unless they explicitly upgrade to the new major. We could |
I tested by running mocha by hand, yep. No regressions, and the REDOS test I added passes with my change and fails without it. I don't think a semver-major bump is necessary. I believe my version accepts precisely the same language as the previous unsafe regex did, but I welcome a second pair of eyes on it. This is what I did. I took the unsafe regex and broke it into two steps for clarity, then tested each of the two domain options separately. But I used what I think are semantically equivalent regexes. The localDomain is slightly modified so that it is safe. On an unrelated note, given the popularity of this project, it might be nice to set up Travis and Mocha so they work properly. Are there issues open for that? |
This PR is publicizing the possibility of REDOS via this popular npm module. Should I take it down until the maintainers are ready to review it? |
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.
LGTM
Yeah not worried about your changes here being a breaking change so much as wanting to avoid publishing a new version that's missing something indirectly like a browser-friendly build artifact or something. I say this because I think this module is not actively maintained any more. |
That said, I do have npm publish rights, so we could just say #yolo, publish it as a patch, and deal with any possible fallout after. |
Seems reasonable to me. If there aren't active maintainers who can tell us the details on publishing, the choices seem to be:
Since this is a popular package I think deprecating is not a good route. I vote #yolo. On a related note, perhaps updating the README with a "looking for a maintainer" advertisement would be good. |
|
A perfect opportunity to use np's |
Problem: PR segmentio#18 changed behavior on: - undefined string - non-strings Solution: Revert to pre-segmentio#18 behavior on non-strings: return false. Test: I added test cases to clarify this behavior. It shouldn't happen again.
Problem: As reported in segmentio#19, PR segmentio#18 changed behavior on: - undefined string - non-strings Solution: Revert to pre-segmentio#18 behavior on non-strings: return false. Test: I added test cases to clarify this behavior. It shouldn't happen again.
Problem: As reported in segmentio#19, PR segmentio#18 changed behavior on: - undefined string - non-strings Solution: Revert to pre-segmentio#18 behavior on non-strings: return false. Test: I added test cases to clarify this behavior. It shouldn't happen again.
Problem:
As disclosed by email, the regex in this module was vulnerable to
catastrophic backtracking.
This could be used as a REDOS vector for Node.js servers that use
this module.
Solution:
Use a two-step validation process.
Split the vulnerable regex into three safe ones.