class Security::RejectAllRequestsLocal
Constants
- MSG
- RAILS_ENV
Public Instance Methods
black_listed?(string)
click to toggle source
# File lib/simplycop/security/reject_all_requests_local.rb, line 15 def black_listed?(string) RAILS_ENV.each_with_object([]) do |env, results| results << string.include?(env) end.any?(true) end
found_match(string)
click to toggle source
# File lib/simplycop/security/reject_all_requests_local.rb, line 21 def found_match(string) string.match(/config.consider_all_requests\S?.*=\s?.*true/) ? true : false end
on_send(node)
click to toggle source
# File lib/simplycop/security/reject_all_requests_local.rb, line 8 def on_send(node) source = node.source file_name = node.loc.operator.to_s add_offense(node, location: :selector) if found_match(source) && black_listed?(file_name) end