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.
Incorrect
Section titled “Incorrect”def search(name) User.where("name = '#{name}'").to_aendCorrect
Section titled “Correct”def search(name) User.where("name = ?", name).to_aendNever embed input into SQL; use bound parameters or parameter placeholders.