Skip to content

fix(api/v2): enforce a cap on number of leaderboard entries that can be returned - #5214

Open
wescopeland wants to merge 1 commit into
RetroAchievements:masterfrom
wescopeland:v2-api-lb-entries-max-results
Open

fix(api/v2): enforce a cap on number of leaderboard entries that can be returned#5214
wescopeland wants to merge 1 commit into
RetroAchievements:masterfrom
wescopeland:v2-api-lb-entries-max-results

Conversation

@wescopeland

Copy link
Copy Markdown
Member

Currently, ?filter[maxRank] has no maximum allowed value. This PR sets a cap at 100.

@wescopeland
wescopeland requested a review from a team September 9, 2026 22:56
@greptile-apps

greptile-apps Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds validation limiting leaderboard maxRank filters to 100.

Confidence Score: 5/5

Safe to merge.

The validation follows existing query conventions and tests the intended rejection.

Reviews (1): Last reviewed commit: "fix(api/v2): enforce a cap on number of ..." | Re-trigger Greptile

public function rules(): array
{
return array_merge(parent::rules(), [
'filter.maxRank' => ['integer', 'min:1', 'max:100'],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really what you want to be restricting? If I query all my leaderboard-entries, there are quite a few where my rank is over 100:

      "attributes": {
        "score": 7250,
        "formattedScore": "1:12.50",
        "rank": 370,
        "createdAt": "2019-03-02T16:30:10.000000Z",
        "updatedAt": "2019-03-02T16:30:10.000000Z"
      },

If you want to limit the number of returned values, you should restrict page[size], which (at least for this endpoint) defaults to 50.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants