Don't allow negative values for pagination
What does this MR do and why?
- Sentry error: https://sentry.gitlab.net/gitlab/gitlabcom/issues/3326721
- Feature flag: #369225
Problem
GitLab API does not support negaative values for pagination and result can be unexpected.
Solution
Return 400 error if negative value is provided to the pagination.
Screenshots or screen recordings
http://127.0.0.1:3000/api/v4/projects/1/repository/commits?page=-1
Before | After |
---|---|
How to set up and validate locally
- Enable feature flag
Feature.enable(:only_positive_pagination_values)
- Visit http://127.0.0.1:3000/api/v4/projects/1/repository/commits?page=-1
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Vasilii Iakliushin