Unsanitized user input in SQL query detected.


Including unsanitized data, such as user input or request data, in raw SQL queries makes your application vulnerable to SQL injection attacks.


❌ Avoid raw queries, especially those that contain unsanitized user input:

User.where("user.email = #{params[:email]}")

✅ Use the ActiveRecord API wherever possible:

User.where(email: params[:email])

✅ Use bind variables:

User.where("user.email = ?", [params[:email]])

✅ Santize the value manually:

User.where(sanitize_sql(["user.email = ?", params[:email]]))


Associated CWE

OWASP Top 10

Ready to take the next step? Join the Bearer Cloud waitlist.