Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
52e903e9
Commit
52e903e9
authored
Aug 21, 2014
by
Marin Jankovski
Committed by
Jacob Vosmaer
Aug 22, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change rack attack example.
parent
e328668f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
config/initializers/rack_attack.rb.example
config/initializers/rack_attack.rb.example
+10
-2
No files found.
config/initializers/rack_attack.rb.example
View file @
52e903e9
...
@@ -8,11 +8,19 @@ paths_to_be_protected = [
...
@@ -8,11 +8,19 @@ paths_to_be_protected = [
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json",
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session.json",
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session",
"#{Rails.application.config.relative_url_root}/api/#{API::API.version}/session",
"#{Rails.application.config.relative_url_root}/users",
"#{Rails.application.config.relative_url_root}/users",
"#{Rails.application.config.relative_url_root}/users/confirmation"
"#{Rails.application.config.relative_url_root}/users/confirmation",
"#{Rails.application.config.relative_url_root}/unsubscribes/*"
]
]
paths_to_be_protected.map! { |path| Regexp.new(path) }
unless Rails.env.test?
unless Rails.env.test?
Rack::Attack.throttle('protected paths', limit: 10, period: 60.seconds) do |req|
Rack::Attack.throttle('protected paths', limit: 10, period: 60.seconds) do |req|
req.ip if paths_to_be_protected.include?(req.path) && req.post?
if req.post?
paths_paths_to_be_protected.each do |protected_path|
req.ip if req.path =~ protected_path
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment