Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
93d35d48
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,发现更多精彩内容 >>
提交
93d35d48
编写于
2月 18, 2014
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check for CVE-2014-0080
上级
9146de53
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
31 addition
and
3 deletion
+31
-3
lib/brakeman/checks/check_sql.rb
lib/brakeman/checks/check_sql.rb
+15
-0
lib/brakeman/warning_codes.rb
lib/brakeman/warning_codes.rb
+2
-1
test/apps/rails4/Gemfile
test/apps/rails4/Gemfile
+1
-1
test/tests/rails4.rb
test/tests/rails4.rb
+13
-1
未找到文件。
lib/brakeman/checks/check_sql.rb
浏览文件 @
93d35d48
...
@@ -51,6 +51,8 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
...
@@ -51,6 +51,8 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
Brakeman
.
debug
"Processing possible SQL calls"
Brakeman
.
debug
"Processing possible SQL calls"
calls
.
each
{
|
call
|
process_result
call
}
calls
.
each
{
|
call
|
process_result
call
}
check_CVE_2014_0080
end
end
#Find calls to named_scope() or scope() in models
#Find calls to named_scope() or scope() in models
...
@@ -638,6 +640,19 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
...
@@ -638,6 +640,19 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
end
end
end
end
# TODO: Move all SQL CVE checks to separate class
def
check_CVE_2014_0080
return
unless
version_between?
"4.0.0"
,
"4.0.2"
and
@tracker
.
config
[
:gems
].
include?
:pg
warn
:warning_type
=>
'SQL Injection'
,
:warning_code
=>
:CVE_2014_0080
,
:message
=>
"Rails
#{
tracker
.
config
[
:rails_version
]
}
contains a SQL injection vulnerability (CVE-2014-0080) with PostgreSQL. Upgrade to 4.0.3"
,
:confidence
=>
CONFIDENCE
[
:high
],
:file
=>
gemfile_or_environment
,
:link_path
=>
"https://groups.google.com/d/msg/rubyonrails-security/Wu96YkTUR6s/pPLBMZrlwvYJ"
end
def
upgrade_version?
versions
def
upgrade_version?
versions
versions
.
each
do
|
low
,
high
,
upgrade
|
versions
.
each
do
|
low
,
high
,
upgrade
|
return
upgrade
if
version_between?
low
,
high
return
upgrade
if
version_between?
low
,
high
...
...
lib/brakeman/warning_codes.rb
浏览文件 @
93d35d48
...
@@ -71,7 +71,8 @@ module Brakeman::WarningCodes
...
@@ -71,7 +71,8 @@ module Brakeman::WarningCodes
:CVE_2013_6416_call
=>
68
,
:CVE_2013_6416_call
=>
68
,
:CVE_2013_6417
=>
69
,
:CVE_2013_6417
=>
69
,
:mass_assign_permit!
=>
70
,
:mass_assign_permit!
=>
70
,
:ssl_verification_bypass
=>
71
:ssl_verification_bypass
=>
71
,
:CVE_2014_0080
=>
72
,
}
}
def
self
.
code
name
def
self
.
code
name
...
...
test/apps/rails4/Gemfile
浏览文件 @
93d35d48
...
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
...
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem
'rails'
,
'4.0.0'
gem
'rails'
,
'4.0.0'
gem
'
sqlite3
'
gem
'
pg
'
# Gems used only for assets and not required
# Gems used only for assets and not required
# in production environments by default.
# in production environments by default.
...
...
test/tests/rails4.rb
浏览文件 @
93d35d48
...
@@ -15,7 +15,7 @@ class Rails4Tests < Test::Unit::TestCase
...
@@ -15,7 +15,7 @@ class Rails4Tests < Test::Unit::TestCase
:controller
=>
0
,
:controller
=>
0
,
:model
=>
1
,
:model
=>
1
,
:template
=>
1
,
:template
=>
1
,
:generic
=>
1
8
:generic
=>
1
9
}
}
end
end
...
@@ -260,6 +260,18 @@ class Rails4Tests < Test::Unit::TestCase
...
@@ -260,6 +260,18 @@ class Rails4Tests < Test::Unit::TestCase
:user_input
=>
nil
:user_input
=>
nil
end
end
def
test_sql_injection_CVE_2014_0080
assert_warning
:type
=>
:warning
,
:warning_code
=>
72
,
:fingerprint
=>
"0ba20216bdda1cc067f9e4795bdb0d9224fd23c58317ecc09db67b6b38a2d0f0"
,
:warning_type
=>
"SQL Injection"
,
:line
=>
nil
,
:message
=>
/^Rails\ 4\.0\.0\ contains\ a\ SQL\ injection\ vul/
,
:confidence
=>
0
,
:relative_path
=>
"Gemfile"
,
:user_input
=>
nil
end
def
test_mass_assignment_with_permit!
def
test_mass_assignment_with_permit!
assert_warning
:type
=>
:warning
,
assert_warning
:type
=>
:warning
,
:warning_code
=>
70
,
:warning_code
=>
70
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录