Class: Dawn::Kb::DeprecationCheck

Inherits:
Object
  • Object
show all
Includes:
BasicCheck
Defined in:
lib/dawn/kb/deprecation_check.rb

Constant Summary collapse

DEPRECATION_MATRIX =
[
  # {:gem=>"rails", :versions=>['0.x', '1.x', '2.x']},
  # {:gem=>"sinatra", :versions=>['0.x', '1.x', '2.x']},
  # {:gem=>"padrino", :versions=>['0.x', '1.x', '2.x']},
  {:gem=>"ruby", :versions=>['1.1.x', '1.2.x', '1.3.x', '1.4.x', '1.5.x', '1.6.x', '1.7.x', '1.8.7']},
]

Constants included from BasicCheck

BasicCheck::ALLOWED_FAMILIES

Instance Attribute Summary collapse

Attributes included from BasicCheck

#applies, #aux_links, #check_family, #cve, #cvss, #cwe, #debug, #evidences, #fixes_version, #kind, #message, #mitigated, #name, #osvdb, #owasp, #priority, #release_date, #remediation, #ruby_version, #ruby_vulnerable_versions, #severity, #status, #target_version, #title

Instance Method Summary collapse

Methods included from BasicCheck

#applies_to?, #cve_link, #cvss_score, families, #family, #family=, #lint, #mitigated?, #nvd_link, #osvdb_link, #rubysec_advisories_link

Methods included from Utils

#__debug_me_and_return, #debug_me, #debug_me_and_return_false, #debug_me_and_return_true

Constructor Details

#initialize(options = {}) ⇒ DeprecationCheck

Returns a new instance of DeprecationCheck.



16
17
18
19
20
21
# File 'lib/dawn/kb/deprecation_check.rb', line 16

def initialize(options={})
  super(options)
  @enable_warning ||= options[:enable_warning]
  debug_me "DeprecationCheck initialized"
  $logger.warn "MVC deprecation check is disable by now" unless self.enable_warning.nil?
end

Instance Attribute Details

#detectedObject

Returns the value of attribute detected.



13
14
15
# File 'lib/dawn/kb/deprecation_check.rb', line 13

def detected
  @detected
end

#enable_warningObject

Returns the value of attribute enable_warning.



14
15
16
# File 'lib/dawn/kb/deprecation_check.rb', line 14

def enable_warning
  @enable_warning
end

Instance Method Details

#vuln?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dawn/kb/deprecation_check.rb', line 23

def vuln?
  debug_me "vuln? @detected is #{@detected}"
  v = Dawn::Kb::VersionCheck.new
  v.debug = self.debug
  v.detected = @detected[:version]

  DEPRECATION_MATRIX.each do |dm|
    v.deprecated = dm[:versions] if dm[:gem] == @detected[:gem]
  end
  return false if v.deprecated.nil?
  return v.is_detected_deprecated?
end