Repository navigation
fix(jsonapi): Reject non-positive page[limit] - #5143
Merged
shepilov merged 1 commit intoNov 2, 2026
Merged
Conversation
A page[limit] of 0 or less was accepted, so the CouchDB limit was dropped and the next links never ended. Answer with a 400 instead, like for a page[limit] that is not a number. Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
shepilov
approved these changes
Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ExtractPaginationCursoracceptedpage[limit]=0or a negative value. The cursor then asked CouchDB for a limit of 0, which is omitted from the view request, so every row was read, and thenextlink kept pointing at the last row forever (an empty result even panicked onRows[:-1]).Now a
page[limit]of 0 or less gets a 400 "page limit must be positive", like apage[limit]that is not a number.Tested with a new unit test (
0,-1,-2147483648must give a 400 and no cursor):go test ./pkg/jsonapi.Fixes #5128