Add GitLab Migration rate limits

What does this MR do and why?

This MR adds rate limits to GitLab Migration (aka BulkImports) in order to limit the amount of migrations allowed per user. Current rate limit is 6 requests per minute per user.

Mentions #386452 (closed)

Screenshots or screen recordings

POST http://gdk.test:3000/api/v4/bulk_imports

...

HTTP/1.1 429 Too Many Requests
{
  "message": {
    "error": "This endpoint has been requested too many times. Try again later."
  }
}

How to set up and validate locally

  1. Initiate GitLab Migration via UI or API more than 6 times per user per minute
POST http://gdk.test:3000/api/v4/bulk_imports
PRIVATE-TOKEN: TOKEN
Content-Type: application/json

{
  "configuration": {
    "url": "http://gdk.test:3000/",
    "access_token": "TOKEN"
  },
  "entities": [
    {
      "source_full_path": "public_group",
      "source_type": "group_entity",
      "destination_slug": "public_test1",
      "destination_namespace": "",
      "migrate_projects": false
    }
  ]
}
  1. Observe 429 error message is returned

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by George Koltsov

Merge request reports

Loading