问题标签 [brakeman]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby-on-rails - 如何让 Brakeman 忽略某些路径
我正在尝试为我的 Rails 项目配置 Brakeman,我希望它忽略某些目录和文件。我找不到指定要排除的路径的选项。有谁知道这是否可能?
ruby - 非 ASCII-8BIT 脚本中的非转义非 ASCII 字符
我有这个正则表达式:
(# -*- encoding : utf-8 -*-
在我的文件中),它在我的应用程序中运行没有任何错误。当我使用brakeman
gem 检查我的应用程序时,它返回以下内容:
1) 为什么会显示警告?(括号字符不是转义了吗?)
2)如果我忽略警告会发生什么不好的事情吗?
3) 无论如何要更改我的代码以实现相同的目标但没有这个问题?
ruby - ruby exec command injection (protection!)
I am running the brakeman gem over a project.. it's complaining about some exec commands that are being run.
Current code:
Process.fork {exec "pdftk #{uncrypted_pdf_file} output #{pdf_file} owner_pw #{password} allow printing"}
Brakeman complains suggesting there's a possibility for command injection. I have tried a few different combinations of calling exec for example:
Process.fork {exec "pdftk", uncrypted_pdf_file, " output #{pdf_file} ", "owner_pw #{password}", "allow printing"}
But as you'd expect, each argument just gets passed to pdftk in turn and so it falls over.
Is there a way to call a command in one shot and also protect against command injection. In our specific case it's safe enough anyway as we control all the variables, but it'd be good to know the right way.
ruby-on-rails-4 - only_path 无法治愈未受保护的重定向
我有一个 Rails 4 应用程序,当我运行 Brakeman 时,它(正确地)在我的创建操作中识别出不受保护的重定向。但是,添加 only_path: true (如在 Brakeman Railscast中)并不能解决警告:
结果是:
为什么会这样?布雷克曼仍在识别什么风险?
ruby-on-rails - 制动器报告 - 用作文件名的直接模型属性
制动员显示以下错误,文件正在使用回形针进行管理。在我的控制器中
资产文件 ||= AssetFile.find(params[:id])
if asset_file
// 下载文件
send_file asset_file.uploaded_file.path , :type => asset_file.uploaded_file_content_type
else
flash[:error] = t('document.mind_your_asset_file')
redirect_to root_url
end
mysql - 在 Rails 中构建动态 SQL 时如何防止 SQL 注入
我正在构建动态 SQL 语句并执行 using ActiveRecord::Base.connection.select_values
,因为查询有点复杂(将 3 到 4 个表与几个 group by 并从多个表中选择列),我需要更快的响应。我们正在使用Brakeman安全扫描器来识别任何 SQL 注入,大多数这些动态查询都被标记为易受 SQL 注入攻击。
我尝试使用一些 Rails 内部方法手动清理用于单引号的动态 SQL 语句中的参数,例如:为了转义(单引号)字符串我尝试了sanitize_sql_for_conditions
其他类似的方法但是 Brakeman 仍然将它们识别为易受 SQL 注入攻击或者单独转义单引号不能解决 SQL 注入问题?
在构建动态 SQL 时是否有更好的方法来处理 SQL 注入?
我正在使用 Rails 2.3 红宝石 1.8.7
sql - sql注入的Rails刹车警告
我的模型中有一个范围:
所以在运行刹车报告后,我收到了这个警告:
所以我尝试了以下方法:
这对我不起作用,因为它'
在 sql 的前后添加了(撇号)。因此,当我将其用作返回一些结果的查询的一部分并应用此范围时,它会生成不正确的 sql。
我也试过这个:
甚至不建立声明。并尝试了其他一些不起作用的东西,甚至不值得一提。有人知道如何解决这个问题吗?
ruby-on-rails - 根据 Brakeman 的说法,为什么是 XSS?
有人可以向我解释为什么这是一个安全问题吗?
我正在尝试向我的项目添加一个简单的部分,以便能够在语言之间切换。我真的不希望这个部分必须与每个控制器交互或将用户切换到不同的页面或必须知道所有可能的有效参数。
ruby-on-rails - path traversal attacks in rails 4.1.0
I am getting file access
warning for following code:
warning is:
When user-supplied input can contain ".." or similar characters that are passed through to file access APIs, causing access to files outside of an intended subdirectory.
I tried to sanitize params with:
but this seem to have no effect on warning of hakiri warning.
ruby-on-rails - Brakeman 提出的 Rails 安全问题
在我的项目中,在使用Brakeman gem时,会出现以下安全问题:
1)在以下语句中,Unescaped model attribute
引发错误
我知道 Rails 使用基于 cookie 的会话存储。然而,Rails 4 使用 cookie 是相对安全的,因为你需要Rails secret token
它来破坏它。
那么,这是误报吗?如果没有,我该如何删除此漏洞?
2)其次,我有一个场景,我需要检查具有典型属性的记录是否存在。为此,我有以下代码
并且 Brakeman 提出以下警告
我怎样才能消除这个漏洞,同时让我的代码干燥?