Module: CMSScanner::Finders::Finding

Included in:
Model::InterestingFinding, Model::User, Model::Version
Defined in:
lib/cms_scanner/finders/finding.rb

Overview

Finding

Constant Summary collapse

FINDING_OPTS =
%i[confidence confirmed_by references found_by interesting_entries].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Fix for “Double/Dynamic Inclusion Problem”



8
9
10
11
# File 'lib/cms_scanner/finders/finding.rb', line 8

def self.included(base)
  base.include References
  super(base)
end

Instance Method Details

#<=>(other) ⇒ Object



49
50
51
# File 'lib/cms_scanner/finders/finding.rb', line 49

def <=>(other)
  to_s.downcase <=> other.to_s.downcase
end

#confidenceInteger

Returns:

  • (Integer)


29
30
31
# File 'lib/cms_scanner/finders/finding.rb', line 29

def confidence
  @confidence ||= 0
end

#confidence=(value) ⇒ Object

Parameters:

  • value (Integer)


34
35
36
# File 'lib/cms_scanner/finders/finding.rb', line 34

def confidence=(value)
  @confidence = value >= 100 ? 100 : value
end

#confirmed_byArray

Returns:

  • (Array)


18
19
20
# File 'lib/cms_scanner/finders/finding.rb', line 18

def confirmed_by
  @confirmed_by ||= []
end

#eql?(other) ⇒ Boolean

TODO: maybe also check for interesting_entries and confirmed_by ? So far this is used in specs only

Returns:

  • (Boolean)


45
46
47
# File 'lib/cms_scanner/finders/finding.rb', line 45

def eql?(other)
  self == other && confidence == other.confidence && found_by == other.found_by
end

#interesting_entriesArray

Should be overriden in child classes

Returns:

  • (Array)


24
25
26
# File 'lib/cms_scanner/finders/finding.rb', line 24

def interesting_entries
  @interesting_entries ||= []
end

#parse_finding_options(opts = {}) ⇒ Object

Parameters:

  • opts (Hash) (defaults to: {})


39
40
41
# File 'lib/cms_scanner/finders/finding.rb', line 39

def parse_finding_options(opts = {})
  FINDING_OPTS.each { |opt| send("#{opt}=", opts[opt]) if opts.key?(opt) }
end