lib/brakeman/checks/check_sql.rb in brakeman-min-2.4.0 vs lib/brakeman/checks/check_sql.rb in brakeman-min-2.4.1
- old
+ new
@@ -49,10 +49,12 @@
Brakeman.debug "Checking version of Rails for CVE issues"
check_rails_versions_against_cve_issues
Brakeman.debug "Processing possible SQL calls"
calls.each { |call| process_result call }
+
+ check_CVE_2014_0080
end
#Find calls to named_scope() or scope() in models
#RP 3 TODO
def find_scope_calls
@@ -634,9 +636,22 @@
target == SELF_CLASS or
node_type? target, :self or
klass == :"ActiveRecord::Base" or
active_record_models.include? klass
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
versions.each do |low, high, upgrade|
return upgrade if version_between? low, high