OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/config/initializers/rack-attack.rb

13 lines
429 B

if OpenProject::Configuration.blacklisted_routes.any?
# Block logins from a bad user agent
Rack::Attack.blacklist('block forbidden routes') do |req|
regex = OpenProject::Configuration.blacklisted_routes.map! { |str| Regexp.new(str) }
regex.any? { |i| i =~ req.path }
end
Rack::Attack.blacklisted_response = lambda do |_env|
# All blacklisted routes would return a 404.
[404, {}, ['Not found']]
end
end