[英]Ruby On Rails - What do these Brakeman warnings mean?
我正在使用brakeman
gem
来扫描我的应用程序。
扫描应用程序后,我收到以下警告:
#Security warnings
Method | Warning Type | Message
------------------------------------------------------
show | Unscoped Find | Unscoped call to PatientMessage#find near line 27: Message.find(+params[:id]+)
------------------------------------------------------
#Controller warnings:
Controller | Warning Type | Message
----------------------------------------------------------------------------
ApplicationController | Cross-Site Request Forgery | 'protect_from_forgery' should be called in ApplicationController
有人可以帮忙弄清楚这些警告的含义吗?
protect_from_forgery错误几乎是不言而喻的(它告诉您在应用程序控制器中包括有助于保护您的站点免受跨站点脚本攻击的方法),但此处的Unscoped Find的文档位于: http:// brakemanscanner。 org / docs / warning_types / unscoped_find /
基本上,它告诉您应该执行以下操作:
current_user.messages.find(params[:id])
而不是Message.find,因此用户不能仅仅通过将id传递给params来查找任何消息。 上面的示例假定您具有current_user帮助器,并且消息属于用户,这在您的应用中可能并非如此,但这就是警告的意思。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.