XPath injection (ARCH6108)
Esta página aún no está disponible en tu idioma.
Key ruby.security.xpath-injection · Severity error · Category security · CWE CWE-643
Concatenating untrusted input into an XPath expression lets attackers alter the query to disclose unauthorized data or bypass authentication.
Incorrect
Section titled “Incorrect”def find(user) doc.xpath("//user[name='#{user}']")endCorrect
Section titled “Correct”def find(user) doc.xpath("//user[name=$name]", nil, name: user)endDo not embed input in XPath; use variable binding (xpath parameters).