XML external entity injection (ARCH6105)
Key ruby.security.xxe · Severity error · Category security · CWE CWE-611
An XML parser configured to resolve external entities and DTDs lets attackers read files, perform SSRF, or cause denial of service.
Incorrect
Section titled “Incorrect”doc = Nokogiri::XML(input) do |config| config.noentendCorrect
Section titled “Correct”doc = Nokogiri::XML(input) do |config| config.nonet.nonoentendDisable entity expansion and external DTD/network access (nonoent, nonet); reject DTDs entirely for untrusted XML.