Issues with the search function and lack of input sanitization
Go to https://publiclab.org/ . Type in "browser based" (with the quotation marks) and press ENTER. An error page occurs.
The URL where the error appears is: https://publiclab.org/search/%22browser%20based%22
This suggests that, at least for queries with quotation marks, the search function doesn't handle certain queries cleanly.
Also, in app/helpers/search_helper.rb, a method generates URLs in HTML without sanitizing the input. There may be other issues involving lack of sanitization in HTML code generation elsewhere in the code. (One way to avoid them is to use a library or set of methods dedicated to HTML code generation.)
Hi, this is really great - thank you! Would you be interested in contributing a fix for this issue? Thank you for documenting it so thoroughly. It seems like there are 2 places it might be fixed - one in search_helper.rb, but also potentially in JavaScript afterwards. But perhaps the JavaScript fix is not even worth it?
Thanks again!
On Thu, Mar 7, 2019 at 4:25 PM Peter Occil [email protected] wrote:
Go to https://publiclab.org/ . Type in "browser based" (with the quotation marks) and press ENTER. An error page occurs.
The URL where the error appears is: https://publiclab.org/search/%22browser%20based%22
This suggests that, at least for queries with quotation marks, the search function doesn't handle certain queries cleanly.
Also, in app/helpers/search_helper.rb, a method generates URLs in HTML without sanitizing the input. There may be other issues involving lack of sanitization in HTML code generation elsewhere in the code.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/publiclab/plots2/issues/4943, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfJzt9MuPUmYpfmzJc-5-FRFHkwSd6ks5vUYOngaJpZM4bkI9w .
i am new, but i think i can fix the issue with js.
@peteroupc would you be solving this issue or @EngrEric can try this issue? Thanks!
In my opinion, issues like lack of input sanitization should be solved by having a dedicated library (such as Nokogiri) generate the HTML code rather than writing such code directly. This not only applies to the issue I found, but anywhere HTML code is generated.
I don't know how exactly to solve the issue with queries in quotation marks, since I didn't find the cause of the error yet.
Also, the issues I found largely affect the Ruby portion of the code, not the JavaScript portion.