Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
社会瑞弟呀
brakeman
提交
7a2105bf
B
brakeman
项目概览
社会瑞弟呀
/
brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7a2105bf
编写于
4月 18, 2012
作者:
J
Justin Collins
提交者:
Justin Collins
4月 19, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Warning#user_input
to report the actual piece of code detected as user input for some warnings
上级
0cd75bcc
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
34 addition
and
13 deletion
+34
-13
lib/brakeman/checks/check_cross_site_scripting.rb
lib/brakeman/checks/check_cross_site_scripting.rb
+1
-0
lib/brakeman/checks/check_evaluation.rb
lib/brakeman/checks/check_evaluation.rb
+2
-1
lib/brakeman/checks/check_execute.rb
lib/brakeman/checks/check_execute.rb
+1
-0
lib/brakeman/checks/check_file_access.rb
lib/brakeman/checks/check_file_access.rb
+2
-1
lib/brakeman/checks/check_link_to.rb
lib/brakeman/checks/check_link_to.rb
+4
-0
lib/brakeman/checks/check_link_to_href.rb
lib/brakeman/checks/check_link_to_href.rb
+2
-0
lib/brakeman/checks/check_redirect.rb
lib/brakeman/checks/check_redirect.rb
+8
-5
lib/brakeman/checks/check_send.rb
lib/brakeman/checks/check_send.rb
+4
-2
lib/brakeman/checks/check_sql.rb
lib/brakeman/checks/check_sql.rb
+4
-1
lib/brakeman/checks/check_without_protection.rb
lib/brakeman/checks/check_without_protection.rb
+4
-1
lib/brakeman/warning.rb
lib/brakeman/warning.rb
+2
-2
未找到文件。
lib/brakeman/checks/check_cross_site_scripting.rb
浏览文件 @
7a2105bf
...
...
@@ -186,6 +186,7 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
:message
=>
message
,
:line
=>
exp
.
line
,
:code
=>
exp
,
:user_input
=>
@matched
.
match
,
:confidence
=>
confidence
end
end
...
...
lib/brakeman/checks/check_evaluation.rb
浏览文件 @
7a2105bf
...
...
@@ -20,11 +20,12 @@ class Brakeman::CheckEvaluation < Brakeman::BaseCheck
#Warns if eval includes user input
def
process_result
result
if
in
clude_user_input?
result
[
:call
][
-
1
]
if
in
put
=
include_user_input?
(
result
[
:call
][
-
1
])
warn
:result
=>
result
,
:warning_type
=>
"Dangerous Eval"
,
:message
=>
"User input in eval"
,
:code
=>
result
[
:call
],
:user_input
=>
input
.
match
,
:confidence
=>
CONFIDENCE
[
:high
]
end
end
...
...
lib/brakeman/checks/check_execute.rb
浏览文件 @
7a2105bf
...
...
@@ -54,6 +54,7 @@ class Brakeman::CheckExecute < Brakeman::BaseCheck
:message
=>
"Possible command injection"
,
:line
=>
call
.
line
,
:code
=>
call
,
:user_input
=>
failure
.
match
,
:confidence
=>
confidence
end
end
...
...
lib/brakeman/checks/check_file_access.rb
浏览文件 @
7a2105bf
...
...
@@ -48,7 +48,8 @@ class Brakeman::CheckFileAccess < Brakeman::BaseCheck
:message
=>
message
,
:confidence
=>
CONFIDENCE
[
:high
],
:line
=>
call
.
line
,
:code
=>
call
:code
=>
call
,
:user_input
=>
input
.
match
end
end
end
...
...
lib/brakeman/checks/check_link_to.rb
浏览文件 @
7a2105bf
...
...
@@ -75,7 +75,9 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
warn
:result
=>
result
,
:warning_type
=>
"Cross Site Scripting"
,
:message
=>
message
,
:highlight
=>
input
.
match
,
:confidence
=>
CONFIDENCE
[
:high
]
elsif
not
tracker
.
options
[
:ignore_model_output
]
and
match
=
has_immediate_model?
(
arg
)
method
=
match
[
2
]
...
...
@@ -91,6 +93,7 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
warn
:result
=>
result
,
:warning_type
=>
"Cross Site Scripting"
,
:message
=>
"Unescaped model attribute in link_to"
,
:user_input
=>
match
,
:confidence
=>
confidence
end
...
...
@@ -107,6 +110,7 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
warn
:result
=>
result
,
:warning_type
=>
"Cross Site Scripting"
,
:message
=>
message
,
:user_input
=>
@matched
.
match
,
:confidence
=>
CONFIDENCE
[
:med
]
end
end
...
...
lib/brakeman/checks/check_link_to_href.rb
浏览文件 @
7a2105bf
...
...
@@ -56,6 +56,7 @@ class Brakeman::CheckLinkToHref < Brakeman::CheckLinkTo
warn
:result
=>
result
,
:warning_type
=>
"Cross Site Scripting"
,
:message
=>
message
,
:user_input
=>
input
.
match
,
:confidence
=>
CONFIDENCE
[
:high
]
end
elsif
has_immediate_model?
url_arg
...
...
@@ -82,6 +83,7 @@ class Brakeman::CheckLinkToHref < Brakeman::CheckLinkTo
warn
:result
=>
result
,
:warning_type
=>
"Cross Site Scripting"
,
:message
=>
message
,
:user_input
=>
@matched
.
match
,
:confidence
=>
CONFIDENCE
[
:med
]
end
end
...
...
lib/brakeman/checks/check_redirect.rb
浏览文件 @
7a2105bf
...
...
@@ -28,7 +28,7 @@ class Brakeman::CheckRedirect < Brakeman::BaseCheck
if
method
==
:redirect_to
and
not
only_path?
(
call
)
and
res
=
include_user_input?
(
call
)
add_result
result
if
res
==
:immediate
if
res
.
type
==
:immediate
confidence
=
CONFIDENCE
[
:high
]
else
confidence
=
CONFIDENCE
[
:low
]
...
...
@@ -39,6 +39,7 @@ class Brakeman::CheckRedirect < Brakeman::BaseCheck
:message
=>
"Possible unprotected redirect"
,
:line
=>
call
.
line
,
:code
=>
call
,
:user_input
=>
res
.
match
,
:confidence
=>
confidence
end
end
...
...
@@ -64,16 +65,18 @@ class Brakeman::CheckRedirect < Brakeman::BaseCheck
call
[
3
].
each
do
|
arg
|
if
call?
arg
if
request_value?
arg
or
request_value?
arg
[
1
]
return
:immediate
if
request_value?
arg
return
Match
.
new
(
:immediate
,
arg
)
elsif
request_value?
arg
[
1
]
return
Match
.
new
(
:immediate
,
arg
[
1
])
elsif
arg
[
2
]
==
:url_for
and
include_user_input?
arg
return
:immediate
return
Match
.
new
(
:immediate
,
arg
)
#Ignore helpers like some_model_url?
elsif
arg
[
2
].
to_s
=~
/_(url|path)$/
return
false
end
elsif
request_value?
arg
return
:immediate
return
Match
.
new
(
:immediate
,
arg
)
end
end
...
...
lib/brakeman/checks/check_send.rb
浏览文件 @
7a2105bf
...
...
@@ -19,19 +19,21 @@ class Brakeman::CheckSend < Brakeman::BaseCheck
args
=
process
result
[
:call
][
3
]
target
=
process
result
[
:call
][
1
]
if
has_immediate_user_input?
args
[
1
]
if
input
=
has_immediate_user_input?
(
args
[
1
])
warn
:result
=>
result
,
:warning_type
=>
"Dangerous Send"
,
:message
=>
"User controlled method execution"
,
:code
=>
result
[
:call
],
:user_input
=>
input
.
match
,
:confidence
=>
CONFIDENCE
[
:high
]
end
if
has_immediate_user_input?
(
target
)
if
input
=
has_immediate_user_input?
(
target
)
warn
:result
=>
result
,
:warning_type
=>
"Dangerous Send"
,
:message
=>
"User defined target of method invocation"
,
:code
=>
result
[
:call
],
:user_input
=>
input
.
match
,
:confidence
=>
CONFIDENCE
[
:med
]
end
end
...
...
lib/brakeman/checks/check_sql.rb
浏览文件 @
7a2105bf
...
...
@@ -122,15 +122,18 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
if
failed
and
not
call
.
original_line
and
not
duplicate?
result
add_result
result
if
in
clude_user_input?
args
[
-
1
]
if
in
put
=
include_user_input?
(
args
[
-
1
])
confidence
=
CONFIDENCE
[
:high
]
user_input
=
input
.
match
else
confidence
=
CONFIDENCE
[
:med
]
user_input
=
nil
end
warn
:result
=>
result
,
:warning_type
=>
"SQL Injection"
,
:message
=>
"Possible SQL injection"
,
:user_input
=>
user_input
,
:confidence
=>
confidence
end
...
...
lib/brakeman/checks/check_without_protection.rb
浏览文件 @
7a2105bf
...
...
@@ -48,10 +48,12 @@ class Brakeman::CheckWithoutProtection < Brakeman::BaseCheck
if
true
?
value
add_result
res
if
in
clude_user_input?
call
[
3
]
if
in
put
=
include_user_input?
(
call
[
3
])
confidence
=
CONFIDENCE
[:
high
]
user_input
=
input
.
match
else
confidence
=
CONFIDENCE
[
:med
]
user_input
=
nil
end
warn
:result
=>
res
,
...
...
@@ -59,6 +61,7 @@ class Brakeman::CheckWithoutProtection < Brakeman::BaseCheck
:message
=>
"Unprotected mass assignment"
,
:line
=>
call
.
line
,
:code
=>
call
,
:user_input
=>
user_input
,
:confidence
=>
confidence
end
...
...
lib/brakeman/warning.rb
浏览文件 @
7a2105bf
#The Warning class stores information about warnings
class
Brakeman::Warning
attr_reader
:called_from
,
:check
,
:class
,
:confidence
,
:controller
,
:line
,
:method
,
:model
,
:template
,
:warning_set
,
:warning_type
:line
,
:method
,
:model
,
:template
,
:
user_input
,
:
warning_set
,
:warning_type
attr_accessor
:code
,
:context
,
:file
,
:message
...
...
@@ -12,7 +12,7 @@ class Brakeman::Warning
@view_name
=
nil
[
:called_from
,
:check
,
:class
,
:code
,
:confidence
,
:controller
,
:file
,
:line
,
:message
,
:method
,
:model
,
:template
,
:warning_set
,
:warning_type
].
each
do
|
option
|
:message
,
:method
,
:model
,
:template
,
:
user_input
,
:
warning_set
,
:warning_type
].
each
do
|
option
|
self
.
instance_variable_set
(
"@
#{
option
}
"
,
options
[
option
])
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录