class Security::CheckForVulnerableCode

Constants

RESULT
VULNERABILITY_LIST

Public Class Methods

read_file() click to toggle source
# File lib/simplycop/security/check_for_vulnerable_code.rb, line 5
def self.read_file
  gem_path = File.expand_path("#{File.dirname(__FILE__)}../../../../")

  file = File.open("#{gem_path}/vuln_db.json", "r").read.strip
  json = JSON.parse(file)
  json["vulnerabilities"]["rails"]
end

Public Instance Methods

on_send(node) click to toggle source
# File lib/simplycop/security/check_for_vulnerable_code.rb, line 23
def on_send(node)
  _, method = *node
  return unless method

  if (info = RESULT[method])
    message = "Rails: Possible vulnerability found, CVE Details - #{info} "

    add_offense(node, location: :selector, message: message)
  end
end