Skip to content

Commit 63311c5

Browse files
Matt Van HornMatt Van Horn
andauthored
Use protect_from_forgery with: :exception (#6926)
Use protect_from_forgery with: :exception (#6920) CodeQL alert #60 (rb/csrf-protection-disabled, CWE-352): calling protect_from_forgery with no with: argument downgrades the failure mode to with: :null_session, weaker than the Rails 5+ default of with: :exception that ActionController::Base would otherwise apply. Make the strategy explicit so the call no longer weakens the default, matching option 2 from the issue (more self-documenting than removing the call entirely). Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
1 parent 813e04e commit 63311c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/controllers/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
44
include Organizational
55
include Users::TimeZone
66

7-
protect_from_forgery
7+
protect_from_forgery with: :exception
88
before_action :store_user_location!, if: :storable_location?
99
before_action :authenticate_user!
1010
before_action :set_current_user

0 commit comments

Comments
 (0)