Ensure we escape variables passed into our SQL query.

This commit is contained in:
Guo Xiang Tan 2017-03-08 20:37:29 +08:00
parent 3c41cb6b7d
commit 10ec554d97

View File

@ -308,9 +308,9 @@ class Search
level = TopicUser.notification_levels[match.to_sym]
posts.where("posts.topic_id IN (
SELECT tu.topic_id FROM topic_users tu
WHERE tu.user_id = #{@guardian.user.id} AND
tu.notification_level >= #{level}
)")
WHERE tu.user_id = :user_id AND
tu.notification_level >= :level
)", user_id: @guardian.user.id, level: level)
end
end