Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
1d318d91
B
Brakeman
项目概览
李少辉-开发者
/
Brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1d318d91
编写于
3月 04, 2015
作者:
J
Justin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #631 from presidentbeef/no_warn_on_mass_assign_with_literal
Avoid warning about mass assignment with literals
上级
e0d94df6
ea7e3909
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
0 deletion
+17
-0
lib/brakeman/checks/check_mass_assignment.rb
lib/brakeman/checks/check_mass_assignment.rb
+2
-0
test/apps/rails_with_xss_plugin/app/controllers/users_controller.rb
...rails_with_xss_plugin/app/controllers/users_controller.rb
+4
-0
test/tests/rails_with_xss_plugin.rb
test/tests/rails_with_xss_plugin.rb
+11
-0
未找到文件。
lib/brakeman/checks/check_mass_assignment.rb
浏览文件 @
1d318d91
...
@@ -82,6 +82,8 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
...
@@ -82,6 +82,8 @@ class Brakeman::CheckMassAssignment < Brakeman::BaseCheck
confidence
=
CONFIDENCE
[
:low
]
confidence
=
CONFIDENCE
[
:low
]
user_input
=
input
.
match
user_input
=
input
.
match
end
end
elsif
node_type?
call
.
first_arg
,
:lit
,
:str
return
else
else
confidence
=
CONFIDENCE
[
:low
]
confidence
=
CONFIDENCE
[
:low
]
user_input
=
nil
user_input
=
nil
...
...
test/apps/rails_with_xss_plugin/app/controllers/users_controller.rb
浏览文件 @
1d318d91
...
@@ -139,4 +139,8 @@ class UsersController < ApplicationController
...
@@ -139,4 +139,8 @@ class UsersController < ApplicationController
def
test_sanitize
def
test_sanitize
@x
=
params
[
:x
]
@x
=
params
[
:x
]
end
end
def
string_mass
User
.
new
(
"stuff"
)
end
end
end
test/tests/rails_with_xss_plugin.rb
浏览文件 @
1d318d91
...
@@ -103,6 +103,17 @@ class RailsWithXssPluginTests < Test::Unit::TestCase
...
@@ -103,6 +103,17 @@ class RailsWithXssPluginTests < Test::Unit::TestCase
:file
=>
/users_controller\.rb/
:file
=>
/users_controller\.rb/
end
end
def
test_mass_assignment_with_string
assert_no_warning
:type
=>
:warning
,
:warning_code
=>
17
,
:fingerprint
=>
"2893b1a48ec56548a5a48d38324c5d78f7845066713ad79bb0ec17032672c862"
,
:warning_type
=>
"Mass Assignment"
,
:line
=>
97
,
:message
=>
/^Unprotected\ mass\ assignment/
,
:confidence
=>
2
,
:relative_path
=>
"app/controllers/other_controller.rb"
,
:user_input
=>
nil
end
def
test_redirect_to_model_instance
def
test_redirect_to_model_instance
assert_no_warning
:type
=>
:warning
,
assert_no_warning
:type
=>
:warning
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录