Skip to content
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

Params sanitization may be wrong #230

Open
genezys opened this issue Oct 21, 2024 · 0 comments
Open

Params sanitization may be wrong #230

genezys opened this issue Oct 21, 2024 · 0 comments

Comments

@genezys
Copy link

genezys commented Oct 21, 2024

Currently, when creating a Filterrific object using initialize_filterrific, it will automatically sanitize the params from the session, query, etc.

The problem with sanitization is that it will break the params send to actual filters inside the model. If your search includes <, & characters, those will be escaped by the sanitization process. This sanitization will change the actual SQL queries and will often return wrong results.

According to the comment in code, it should protect against XSS, if the user injects HTML tags in the Filterrific params.

# Sanitizes value to prevent xss attack.

In my application, I completely emptied the logic of the method sanitize_filterrific_param and I was unable to reproduce any XSS injection issues. My tests show that Rails automatic sanitization of strings will correctly escape Filterrific params if displayed in the view using <%= @filterrific.name_of_filter %>.

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

No branches or pull requests

1 participant