Enforce offset pagination limit on Projects API

What does this MR do and why?

Enforces the offset pagination limits to unauthenticated Projects API requests (defaults to 50,000 offset)

https://docs.gitlab.com/administration/instance_limits/#max-offset-allowed-by-the-rest-api-for-offset-based-pagination

References

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Make an unauthenticated requests to http://localhost:3000/api/v4/projects?page=2501
    • Based on 2501 (page) * 20 (default page size) = 50,020.
  2. You should get the following result {"error":"Offset pagination has a maximum allowed offset of 50000 for requests that return objects of type Project. Remaining records can be retrieved using keyset pagination."}

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.

Edited by Shane Maglangit

Merge request reports

Loading