Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

Scheduled maintenance on the database layer will take place on 2022-07-02. We expect GitLab.com to be unavailable for up to 2 hours starting from 06:00 UTC. Kindly follow our status page for updates and read more in our blog post.

  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !30635

Add RateLimiter to RawController

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Mayra Cabrera requested to merge 48717-rate-limit-raw-controller-show into master Jul 11, 2019
  • Overview 39
  • Commits 2
  • Pipelines 17
  • Changes 12

What does this MR do?

Add a Rate Limiter Request to RawController.

  • Limits raw requests to 300 per minute and per raw path.
  • Add a new attribute to ApplicationSettings so user can change this value on their instance.
  • Uses Gitlab::ActionRateLimiter to limit the raw requests.
  • Add a new method into ActionRateLimiter to log the event into auth.log

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/48717

Does this MR meet the acceptance criteria?

Conformity

  • Changelog entry
  • [-] Documentation created/updated or follow-up review issue created
  • [-] Code review guidelines
  • [-] Merge request performance guidelines
  • Style guides
  • Database guides
  • Separation of EE specific content

Performance and testing

  • Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
  • [-] Tested in all supported browsers

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

Screenshots

Admin area Raw endpoint blocked
Screen_Shot_2019-07-22_at_9.07.10_AM Screen_Shot_2019-07-16_at_9.12.46_AM

Manual QA:

  1. For testing purposes, the rate limit request was set to 10 requests per minute.
  2. First tab uses: http://localhost:3000/root/gitlab-ce/raw/9c2d0d87581f34567e33de1b384f1f360edcd4b7/app/helpers/labels_helper.rb
  3. Second tab uses: http://localhost:3000/root/gitlab-ce/raw/9C2D0D87581f34567e33de1b384f1f360eDcd4b7/app/helpers/labels_helper.rb

20190717

To do

  • Make RateLimiter to accept a string as a key (Right now it only accepts Active Record models)
  • Limit endpoint to 300 requests per minute
    • Value should be read from ApplicationSetting or config. Default to 300.
  • If there are more log the requests (probably to auth.log)
  • Tests and refactor
  • Manual QA
Edited Jul 22, 2019 by Mayra Cabrera
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 48717-rate-limit-raw-controller-show