Skip to content

Authenticate runner requests in Rack::Attack

What does this MR do?

related issue: #22465 (closed)

throttle('throttle_unauthenticated', Gitlab::Throttle.unauthenticated_options) do |req|
    if !req.should_be_skipped? &&
        Gitlab::Throttle.settings.throttle_unauthenticated_enabled &&
        req.unauthenticated?
      req.ip
    end
  end

Requests made by runners were not authenticated because we were looking only for users, so req.unauthenticated? returned true. Now Request#unauthenticated? searches also for Ci::Runner if the request has a token parameter and it's made to an API endpoint.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Costel Maxim

Merge request reports