Ir al contenido

SQL injection (ARCH6100)

Esta página aún no está disponible en tu idioma.

Key ruby.security.sql-injection · Severity error · Category security · CWE CWE-89

Interpolating or concatenating user input directly into SQL text lets attackers alter the query structure to exfiltrate or modify data.

def search(name)
User.where("name = '#{name}'").to_a
end
def search(name)
User.where("name = ?", name).to_a
end

Never embed input into SQL; use bound parameters or parameter placeholders.