-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SECURITY: Restrict message-bus access on login_required sites
- Loading branch information
1 parent
ab3e180
commit d237da1
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
describe 'message bus integration' do | ||
|
||
it "allows anonymous requests to the messagebus" do | ||
post "/message-bus/poll" | ||
expect(response.status).to eq(200) | ||
end | ||
|
||
it "allows authenticated requests to the messagebus" do | ||
sign_in Fabricate(:user) | ||
post "/message-bus/poll" | ||
expect(response.status).to eq(200) | ||
end | ||
|
||
context "with login_required" do | ||
before { SiteSetting.login_required = true } | ||
|
||
it "blocks anonymous requests to the messagebus" do | ||
post "/message-bus/poll" | ||
expect(response.status).to eq(403) | ||
end | ||
|
||
it "allows authenticated requests to the messagebus" do | ||
sign_in Fabricate(:user) | ||
post "/message-bus/poll" | ||
expect(response.status).to eq(200) | ||
end | ||
end | ||
|
||
end |