Skip to content

Move the protected paths throttle from Omnibus to GitLab rails

After gitlab-foss#62756 (moved) / gitlab-foss!30467 (merged), we're logging the user information on auth.log, but only for Rack::Attack throttle events. It'd be useful to have the same information for blacklist events.

Technical bits

From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30467#note_189543725:

It looks like in Omnibus (/opt/gitlab/embedded/service/gitlab-rails/config/initializers/rack_attack.rb), we have:

  Rack::Attack.throttle('protected paths', limit: 10, period: 60.seconds) do |req|
    if req.post? && req.path =~ paths_regex
      req.ip
    end
  end

In this case we're returning the IP, and I think there are cases from support where we would like to have the username in this case.

Backend Plan

On %12.4

On %12.5

On %13.0

Because of the Omnibus deprecated policy, we have to wait until the next major release (%13.0) to continue with the following items:

On %13.1

  • [-] Rename rack_attack_new.rb back to rack_attack.rb. Follow up issue created #218291 (closed)

Development log

  • Merge request was created to add Protected paths configuration into GitLab-rails - !16463 (merged)
  • GitLab documentation is going to be updated on !16540 (merged)
  • An issue on Omnibus GitLab was created to decide the removal target date of the Protected Path settings on Omnibus omnibus-gitlab#4688 (closed)
  • Because the protected path throttle also exists on Omnibus, a manual test was done by Stan to check the behavior of both throttles
  • From the Omnibus Deprecation policy, removal target of Omnibus throttle will be on the next major release (%13.0)
  • Merge request to fix a broken link on "Protected paths" setting was created - !17945 (merged)
Edited by Mayra Cabrera