Enforce CI Lint rate limit by default

What does this MR do and why?

Enforce CI Lint rate limit by default

Remove the ci_enforce_ci_lint_rate_limit feature flag so requests over ci_lint_limit_per_user are always rejected with 429, and lint requests are always excluded from the pipeline creation rate limits.

The limit defaults to 0 (unlimited) on every instance after the 19.5 reset migration. Lint requests that don't simulate a pipeline no longer count toward the pipeline creation limits, so on instances that set pipeline creation limits but no CI Lint limit, those requests are no longer rate limited.

Document the GitLab.com value of 400 requests each minute.

Changelog: added

References

Relates to https://gitlab.com/gitlab-org/gitlab/-/work_items/599486 and https://gitlab.com/gitlab-org/gitlab/-/work_items/602468

How to set up and validate locally

  1. In the Admin area, go to Settings > Network > Pipeline creation rate limits and set Maximum number of CI Lint requests for a user to 1. Confirm the hint about the ci_enforce_ci_lint_rate_limit feature flag no longer appears under the field.

  2. Send two lint requests within one minute (replace <project_id> and <token>, a personal access token with the api scope for a user with at least the Developer role):

    for i in 1 2; do
      curl -s -o /dev/null -w "%{http_code}\n" \
        --header "PRIVATE-TOKEN: <token>" --header "Content-Type: application/json" \
        --data '{"content": "test:\n  script: echo ok"}' \
        "http://127.0.0.1:3000/api/v4/projects/<project_id>/ci/lint"
    done

    Expected: 200, then 429, without any feature flag enabled.

  3. Confirm the rejected request is logged as enforced:

    grep "CI Lint rate limit exceeded" log/application_json.log | tail -1

    Expected: the entry includes "throttled":true.

  4. Set the CI Lint limit back to 0 and repeat step 2. Expected: 200 both times (no limit).

  5. To check that Pipeline Editor lint requests no longer count toward the pipeline creation limit, set Max requests per minute per user to 1, keep the CI Lint limit at 0, and run this mutation three times in GraphiQL (http://127.0.0.1:3000/-/graphql-explorer):

    mutation {
      ciLint(input: { projectPath: "<full/project/path>", content: "test:\n  script: echo ok" }) {
        config { status }
        errors
      }
    }

    Expected: every call returns VALID with no errors.

  6. With the same settings, add dryRun: true to the mutation input and run it twice. Expected: the first call returns VALID, the second returns INVALID with Too many pipelines created in the last minute. Try again later. Pipeline simulations still count toward the pipeline creation limit, which shows the limit in step 5 was active.

  7. Reset both limits to their previous values.

The rate limit is per user and resets every minute. If a step returns an unexpected 429, wait one minute and try again.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #599486

Edited by Tarun Raja

Merge request reports

Loading
Loading