WpItem::Vulnerable

Attributes

vulns_file[RW]
vulns_xpath[RW]

Public Instance Methods

vulnerabilities() click to toggle source

Get the vulnerabilities associated to the WpItem Filters out already fixed vulnerabilities

@return [ Vulnerabilities ]

# File lib/common/models/wp_item/vulnerable.rb, line 10
def vulnerabilities
  xml             = xml(vulns_file)
  vulnerabilities = Vulnerabilities.new

  xml.xpath(vulns_xpath).each do |node|
    vuln = Vulnerability.load_from_xml_node(node)
    if vulnerable_to?(vuln)
      vulnerabilities << vuln
    end
  end
  vulnerabilities
end
vulnerable_to?(vuln) click to toggle source

Checks if a item is vulnerable to a specific vulnerability

@param [ Vulnerability ] vuln Vulnerability to check the item against

@return [ Boolean ]

# File lib/common/models/wp_item/vulnerable.rb, line 28
def vulnerable_to?(vuln)
  if version && vuln && vuln.fixed_in && !vuln.fixed_in.empty?
    unless VersionCompare::is_newer_or_same?(vuln.fixed_in, version)
      return true
    end
  else
    return true
  end
  return false
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.