Class: RuboCop::Cop::Paraxial::CSRF

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/paraxial/csrf.rb

Constant Summary collapse

MSG =
'CSRF, no protect_from_forgery in ApplicationController.'

Instance Method Summary collapse

Instance Method Details

#on_class(node) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rubocop/cop/paraxial/csrf.rb', line 11

def on_class(node)
  class_name = node.loc.name.source

  return unless class_name == 'ApplicationController'

  protect_from_forgery = protect_from_forgery_call(node).first

  add_offense(node) unless protect_from_forgery
end