关于使用参数进行用户重定向的 OWASP 文档的说明
Clarifications about OWASP documentation for user redirection by using parameters
我在 Rails 4.1.1 上使用 Ruby,我想接受一个 redirect_path
参数,以便在用户执行操作后重定向他们。我阅读了 OWASP documentation 有关相关问题(网络钓鱼攻击)的内容,但我不明白某些事情。文档指出:
The most basic, but restrictive protection is to use the :only_path
option. Setting this to true will essentially strip out any host
information.
redirect_to params[:url], :only_path => true
redirect_to params[:url], :only_path => true
是否足以避免网络钓鱼攻击?可能还有其他陷阱?
Brakeman 建议两种降低风险的策略:
- 像你一样使用
only_path
;
- 正在解析重定向 URL 以手动提取路径
URI.parse(some_url).path
在过去的项目中,我重写了该帮助程序,以确保没有人会不小心忘记 #1 的额外参数。
我在 Rails 4.1.1 上使用 Ruby,我想接受一个 redirect_path
参数,以便在用户执行操作后重定向他们。我阅读了 OWASP documentation 有关相关问题(网络钓鱼攻击)的内容,但我不明白某些事情。文档指出:
The most basic, but restrictive protection is to use the :only_path option. Setting this to true will essentially strip out any host information.
redirect_to params[:url], :only_path => true
redirect_to params[:url], :only_path => true
是否足以避免网络钓鱼攻击?可能还有其他陷阱?
Brakeman 建议两种降低风险的策略:
- 像你一样使用
only_path
; - 正在解析重定向 URL 以手动提取路径
URI.parse(some_url).path
在过去的项目中,我重写了该帮助程序,以确保没有人会不小心忘记 #1 的额外参数。