vendredi 17 avril 2015

Possible sql injection

I'm using sequel gem in my project, and I have code something like this :



def self.search(query)
return self.scoped if query.blank?

self.joins(:supplier).where{lower(supplier.supplier_name).like_any(["%#{query}%"])}
end


My questions is this code vulnerable to SQL injection? And how do I fix it? I tried to do sanitize(query) but it just adds extra set of quotes and the SQL statement doesn't get generated appropriately


Aucun commentaire:

Enregistrer un commentaire