Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
edaa05d0
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,发现更多精彩内容 >>
提交
edaa05d0
编写于
2月 15, 2012
作者:
N
Neil Matatall
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Shaves 3 seconds off a large project, cleans up some code, review for side effects
上级
f9d610a7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
13 deletion
+13
-13
lib/brakeman/checks/check_cross_site_scripting.rb
lib/brakeman/checks/check_cross_site_scripting.rb
+4
-2
lib/brakeman/checks/check_link_to.rb
lib/brakeman/checks/check_link_to.rb
+9
-11
未找到文件。
lib/brakeman/checks/check_cross_site_scripting.rb
浏览文件 @
edaa05d0
...
@@ -71,6 +71,8 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
...
@@ -71,6 +71,8 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
end
end
def
check_for_immediate_xss
exp
def
check_for_immediate_xss
exp
return
if
duplicate?
exp
if
exp
[
0
]
==
:output
if
exp
[
0
]
==
:output
out
=
exp
[
1
]
out
=
exp
[
1
]
elsif
exp
[
0
]
==
:escaped_output
and
raw_call?
exp
elsif
exp
[
0
]
==
:escaped_output
and
raw_call?
exp
...
@@ -79,7 +81,7 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
...
@@ -79,7 +81,7 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
type
,
match
=
has_immediate_user_input?
out
type
,
match
=
has_immediate_user_input?
out
if
type
and
not
duplicate?
exp
if
type
add_result
exp
add_result
exp
case
type
case
type
when
:params
when
:params
...
@@ -102,7 +104,7 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
...
@@ -102,7 +104,7 @@ class Brakeman::CheckCrossSiteScripting < Brakeman::BaseCheck
elsif
not
tracker
.
options
[
:ignore_model_output
]
and
match
=
has_immediate_model?
(
out
)
elsif
not
tracker
.
options
[
:ignore_model_output
]
and
match
=
has_immediate_model?
(
out
)
method
=
match
[
2
]
method
=
match
[
2
]
unless
duplicate?
out
or
IGNORE_MODEL_METHODS
.
include?
method
unless
IGNORE_MODEL_METHODS
.
include?
method
add_result
out
add_result
out
if
MODEL_METHODS
.
include?
method
or
method
.
to_s
=~
/^find_by/
if
MODEL_METHODS
.
include?
method
or
method
.
to_s
=~
/^find_by/
...
...
lib/brakeman/checks/check_link_to.rb
浏览文件 @
edaa05d0
...
@@ -34,6 +34,8 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
...
@@ -34,6 +34,8 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
end
end
def
process_result
result
def
process_result
result
return
if
duplicate?
result
#Have to make a copy of this, otherwise it will be changed to
#Have to make a copy of this, otherwise it will be changed to
#an ignored method call by the code above.
#an ignored method call by the code above.
call
=
result
[
:call
]
=
result
[
:call
].
dup
call
=
result
[
:call
]
=
result
[
:call
].
dup
...
@@ -58,19 +60,15 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
...
@@ -58,19 +60,15 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
message
=
"Unescaped user input value in link_to"
message
=
"Unescaped user input value in link_to"
end
end
unless
duplicate?
result
add_result
result
add_result
result
warn
:result
=>
result
,
warn
:result
=>
result
,
:warning_type
=>
"Cross Site Scripting"
,
:warning_type
=>
"Cross Site Scripting"
,
:message
=>
message
,
:message
=>
message
,
:confidence
=>
CONFIDENCE
[
:high
]
:confidence
=>
CONFIDENCE
[
:high
]
end
elsif
not
tracker
.
options
[
:ignore_model_output
]
and
match
=
has_immediate_model?
(
first_arg
)
elsif
not
tracker
.
options
[
:ignore_model_output
]
and
match
=
has_immediate_model?
(
first_arg
)
method
=
match
[
2
]
method
=
match
[
2
]
unless
duplicate?
result
or
IGNORE_MODEL_METHODS
.
include?
method
unless
IGNORE_MODEL_METHODS
.
include?
method
add_result
result
add_result
result
if
MODEL_METHODS
.
include?
method
or
method
.
to_s
=~
/^find_by/
if
MODEL_METHODS
.
include?
method
or
method
.
to_s
=~
/^find_by/
...
@@ -92,7 +90,7 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
...
@@ -92,7 +90,7 @@ class Brakeman::CheckLinkTo < Brakeman::CheckCrossSiteScripting
message
=
"Unescaped parameter value in link_to"
message
=
"Unescaped parameter value in link_to"
end
end
if
message
and
not
duplicate?
result
if
message
add_result
result
add_result
result
warn
:result
=>
result
,
warn
:result
=>
result
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录