Skip to content
Snippets Groups Projects
Commit 0fd901bd authored by Tiago Botelho's avatar Tiago Botelho
Browse files

Disables Rack Attack by default

parent 40631412
No related branches found
No related tags found
1 merge request!10495Merge Requests - Assignee
Loading
Loading
@@ -418,7 +418,7 @@ Settings['extra'] ||= Settingslogic.new({})
#
Settings['rack_attack'] ||= Settingslogic.new({})
Settings.rack_attack['git_basic_auth'] ||= Settingslogic.new({})
Settings.rack_attack.git_basic_auth['enabled'] = true if Settings.rack_attack.git_basic_auth['enabled'].nil?
Settings.rack_attack.git_basic_auth['enabled'] = false if Settings.rack_attack.git_basic_auth['enabled'].nil?
Settings.rack_attack.git_basic_auth['ip_whitelist'] ||= %w{127.0.0.1}
Settings.rack_attack.git_basic_auth['maxretry'] ||= 10
Settings.rack_attack.git_basic_auth['findtime'] ||= 1.minute
Loading
Loading
Loading
Loading
@@ -381,6 +381,10 @@ describe 'Git HTTP requests' do
 
context "when authentication fails" do
context "when the user is IP banned" do
before do
Gitlab.config.rack_attack.git_basic_auth['enabled'] = true
end
it "responds with status 401" do
expect(Rack::Attack::Allow2Ban).to receive(:filter).and_return(true)
allow_any_instance_of(Rack::Request).to receive(:ip).and_return('1.2.3.4')
Loading
Loading
@@ -420,6 +424,10 @@ describe 'Git HTTP requests' do
end
 
context "when the user isn't blocked" do
before do
Gitlab.config.rack_attack.git_basic_auth['enabled'] = true
end
it "resets the IP in Rack Attack on download" do
expect(Rack::Attack::Allow2Ban).to receive(:reset).twice
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment