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

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

Constant Summary collapse

MSG =
"CSRF, action_dispatch.cookies_same_site_protection set to `nil` or `:none`."

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



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

def on_send(node)
  return unless node.method_name == :cookies_same_site_protection=

  argument = node.arguments.first

  if !argument.respond_to?(:value)
    add_offense(node)
  elsif argument.value == :none
    add_offense(node)
  end
end