-
-
Notifications
You must be signed in to change notification settings - Fork 836
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
Search highlighting is prone to regular expression injection #1458
Comments
It's very inappropriate to post security bugs on the issue tracker page. You should have mailed the development team instead. |
@DanielTheGeek thanks for your concern, I'd like to kindly point out that:
|
Oh, okay... thanks for pointing that out. |
lodash has a escapeRegExp method, we can use that or something like (suggested at https://stackoverflow.com/a/6969486):
which one do you think is better? |
@sijad lodash sounds good, just make sure Webpack tree shakes properly :) |
@datitisev it's not enough to just visit a search URL; you need to actually type a phrase into the search box for it to be parsed as a regular expression. |
Whatever you enter in the search field is being put unescaped into a regular expression to locally highlight matches. For example:
https://discuss.flarum.org/?q=test%20%5Bblah%5D%2B%20test
You can also easily crash the search by typing an invalid pattern:
https://discuss.flarum.org/?q=test%20%2B%20test
The text was updated successfully, but these errors were encountered: