Commit 68dbda3d6afa942f567f31a24922ceb3d353c8cc
1 parent
d0fcfaeb
Exists in
master
and in
17 other branches
Import rack_attack.rb template from GitLab
Showing
1 changed file
with
18 additions
and
0 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/templates/default/rack_attack.rb.example
0 → 100644
... | ... | @@ -0,0 +1,18 @@ |
1 | +# 1. Rename this file to rack_attack.rb | |
2 | +# 2. Review the paths_to_be_protected and add any other path you need protecting | |
3 | +# | |
4 | + | |
5 | +paths_to_be_protected = [ | |
6 | + "#{Rails.application.config.relative_url_root}/users/password", | |
7 | + "#{Rails.application.config.relative_url_root}/users/sign_in", | |
8 | + "#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json", | |
9 | + "#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session", | |
10 | + "#{Rails.application.config.relative_url_root}/users", | |
11 | + "#{Rails.application.config.relative_url_root}/users/confirmation" | |
12 | +] | |
13 | + | |
14 | +unless Rails.env.test? | |
15 | + Rack::Attack.throttle('protected paths', limit: 10, period: 60.seconds) do |req| | |
16 | + req.ip if paths_to_be_protected.include?(req.path) && req.post? | |
17 | + end | |
18 | +end | ... | ... |