Skip to content

Restrict pagination per_page possible values

Vasilii Iakliushin requested to merge restrict_pagination_per_page_values into master

What does this MR do and why?

Sentry error: https://sentry.gitlab.net/gitlab/gitlabcom/issues/3168349

Problem

Providing 0 value for per_page causes various internal errors.

Solution

  • Do not allow to provide 0 for per_page
  • Return API error when this happens

We can consider restricting all negative values as well. However, it might brake existing integrations. 🤔

Screenshots or screen recordings

Screenshot_2022-01-30_at_18.40.23

How to set up and validate locally

http://127.0.0.1:3000/api/v4/projects/6/repository/tags?per_page=0

MR acceptance checklist

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

Merge request reports