Sha256: d1e6fb79d9259affa53c830e7f894a362ae7a2826a6777d874da671cd36f5af0
Contents?: true
Size: 842 Bytes
Versions: 14
Compression:
Stored size: 842 Bytes
Contents
module Security class CheckForVulnerableCode < RuboCop::Cop::Base RESULT = {} def self.read_file gem_path = File.expand_path("#{File.dirname(__FILE__)}../../../../") file = File.read("#{gem_path}/vuln_db.json").strip json = JSON.parse(file) json["vulnerabilities"]["rails"] end VULNERABILITY_LIST = read_file VULNERABILITY_LIST.each do |string| search = string["search_string"] info = string["info"] RESULT[search.to_sym] = info def_node_matcher search.to_sym, "(send _ :#{search} _)" end def on_send(node) _, method = *node return unless method if (info = RESULT[method]) message = "Rails: Possible vulnerability found, CVE Details - #{info} " add_offense(node.loc.selector, message: message) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems