Commit bcd813c0 authored by Mayra Cabrera's avatar Mayra Cabrera Committed by Stan Hu

Limit user information to RackAttack throttles

rack.attack.match_discriminator is only return on
throttle_authenticated_api or throttle_authenticated_web requests, so
we're avoiding logging user_id on blacklist requests

Follow up of https://gitlab.com/gitlab-org/gitlab-ce/issues/62756
parent 735f360c
......@@ -12,7 +12,7 @@ ActiveSupport::Notifications.subscribe('rack.attack') do |name, start, finish, r
fullpath: req.fullpath
}
if req.env['rack.attack.matched'] != 'throttle_unauthenticated'
if %w(throttle_authenticated_api throttle_authenticated_web).include? req.env['rack.attack.matched']
user_id = req.env['rack.attack.match_discriminator']
user = User.find_by(id: user_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment