Enable forgery protection in ActionController

We were manually adding forgery protection to all our controllers, but
in Rails 5.2 there's an option (enabled by default for new applications)
which adds this protection to all controllers.
This commit is contained in:
Javi Martín
2020-09-05 17:51:56 +02:00
parent e58bd7f6f9
commit 305bf9161c
4 changed files with 1 additions and 4 deletions

View File

@@ -7,7 +7,6 @@ class ApplicationController < ActionController::Base
include AccessDeniedHandler
default_form_builder ConsulFormBuilder
protect_from_forgery with: :exception
before_action :authenticate_http_basic, if: :http_basic_auth_site?

View File

@@ -2,7 +2,6 @@ class Management::BaseController < ActionController::Base
include GlobalizeFallbacks
layout "management"
default_form_builder ConsulFormBuilder
protect_from_forgery with: :exception
before_action :verify_manager
before_action :set_locale

View File

@@ -4,7 +4,6 @@ class Management::SessionsController < ActionController::Base
include GlobalizeFallbacks
include AccessDeniedHandler
default_form_builder ConsulFormBuilder
protect_from_forgery with: :exception
def create
destroy_session

View File

@@ -25,7 +25,7 @@
# Add default protection from forgery to ActionController::Base instead of in
# ApplicationController.
# Rails.application.config.action_controller.default_protect_from_forgery = true
Rails.application.config.action_controller.default_protect_from_forgery = true
# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
# Rails.application.config.active_support.use_sha1_digests = true