我试图允许用户在他们的帖子中发布链接。我使用 auto_link 宝石。
以这种方式免受 xss 和其他攻击是否安全?
def show_content(content_with_links)
auto_link (sanitize content_with_links.join(" "), tags: %w(a))
end
我试图允许用户在他们的帖子中发布链接。我使用 auto_link 宝石。
以这种方式免受 xss 和其他攻击是否安全?
def show_content(content_with_links)
auto_link (sanitize content_with_links.join(" "), tags: %w(a))
end
根据README,它受到恶意脚本的保护:
auto_link("Go to http://www.rubyonrails.org <script>Malicious code!</script>")
# => "Go to <a href=\"http://www.rubyonrails.org\">http://www.rubyonrails.org</a> "