2019-05-23 20:45:02 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
#
|
2016-11-18 13:45:52 -05:00
|
|
|
# Adds logging for all Rack Attack blocks and throttling events.
|
|
|
|
|
|
|
|
ActiveSupport::Notifications.subscribe('rack.attack') do |name, start, finish, request_id, req|
|
|
|
|
if [:throttle, :blacklist].include? req.env['rack.attack.match_type']
|
2019-05-23 20:45:02 -04:00
|
|
|
Gitlab::AuthLogger.error(
|
|
|
|
message: 'Rack_Attack',
|
|
|
|
env: req.env['rack.attack.match_type'],
|
|
|
|
ip: req.ip,
|
|
|
|
request_method: req.request_method,
|
|
|
|
fullpath: req.fullpath
|
|
|
|
)
|
2016-11-18 13:45:52 -05:00
|
|
|
end
|
|
|
|
end
|