fix: sanitize non-numeric pagination parameters using Number() insteAD#380
Open
Clinton6801 wants to merge 8 commits into
Open
fix: sanitize non-numeric pagination parameters using Number() insteAD#380Clinton6801 wants to merge 8 commits into
Clinton6801 wants to merge 8 commits into
Conversation
…d params (default limit 10, not 20)
4bb915e to
a6752b9
Compare
31d37a9 to
03a7172
Compare
…e for formatting compliance
8055c95 to
c72d727
Compare
36cedde to
0138ee4
Compare
3m1n3nc3
reviewed
Jun 25, 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.
Fix Issue #358: Sanitize Non-Numeric Pagination Parameters
Problem
List endpoints were returning HTTP 500 errors when receiving non-numeric pagination query parameters (e.g.,
?page=abc&limit=-5).Root cause:
parseInt("abc")returnsNaN, and the conditionNaN < 1evaluates tofalse, causing invalid values to pass validation and crash Prisma queries.Solution
Replaced
parseInt()withNumber()and added explicitNumber.isNaN()checks in all pagination parameter parsing across list endpoints.Changes
app/app/api/posts/route.tsapp/app/api/posts/[id]/comments/route.tsapp/app/api/posts/[id]/entries/route.tsapp/app/api/users/[id]/followers/route.tsapp/app/api/users/[id]/following/route.tsParsing Pattern