Skip to content

Commit

Permalink
Merge pull request #127 from SuperTux88/csrf-protection
Browse files Browse the repository at this point in the history
Disable forgery protection for ReceiveController
  • Loading branch information
SuperTux88 committed Jul 23, 2022
2 parents 15465bf + 8a8678c commit 20cbbfe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/controllers/diaspora_federation/receive_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
module DiasporaFederation
# This controller processes receiving messages.
class ReceiveController < ApplicationController
skip_forgery_protection

# Receives public messages
#
# POST /receive/public
Expand Down
6 changes: 5 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@
expect_config.syntax = :expect
end

unless defined?(::Rails)
if defined?(::Rails)
config.before(:each, type: :controller) do
ActionController::Base.allow_forgery_protection = true
end
else
config.exclude_pattern = "**/controllers/**/*_spec.rb, **/routing/**/*_spec.rb"
config.filter_run_excluding rails: true
end
Expand Down

0 comments on commit 20cbbfe

Please sign in to comment.