Skip to content

Commit 1d02d8e

Browse files
Don't verify CSRF authenticity token in mail handler (#37030).
Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@21568 e93f8b46-1217-0410-a6f0-8f06a7374b81
1 parent 5e1e868 commit 1d02d8e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app/controllers/mail_handler_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ class MailHandlerController < ActionController::Base
2222

2323
before_action :check_credential
2424

25+
# Requests from rdm-mailhandler.rb don't contain CSRF tokens
26+
skip_before_action :verify_authenticity_token
27+
2528
# Displays the email submission form
2629
def new
2730
end

test/functional/mail_handler_controller_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,11 @@ def test_new
170170
end
171171
assert_response :success
172172
end
173+
174+
def test_should_skip_verify_authenticity_token
175+
ActionController::Base.allow_forgery_protection = true
176+
assert_nothing_raised {test_should_create_issue}
177+
ensure
178+
ActionController::Base.allow_forgery_protection = false
179+
end
173180
end

0 commit comments

Comments
 (0)