Skip to content

fix(state): reject invalid GraphQL pagination cursors - #8779

Open
BenMacha wants to merge 2 commits into
api-platform:5.0from
BenMacha:fix-graphql-invalid-cursor-5-0
Open

BenMacha wants to merge 2 commits into
api-platform:5.0from
BenMacha:fix-graphql-invalid-cursor-5-0

Conversation

@BenMacha

@BenMacha BenMacha commented Nov 1, 2026

Copy link
Copy Markdown
Q A
Branch? 5.0
Tickets
License MIT
Doc PR

GraphQL after/before cursors were base64-decoded and cast without validation: a cursor encoding -5 gave a negative offset (the database rejects it, 500) and one encoding 9999999999999999999 returned a float from an int method (TypeError, 500). A cursor that decodes to anything else than an integer between 0 and PHP_INT_MAX - 1 now throws the existing InvalidArgumentException. A cursor that is not valid base64 behaves as before.

Test: src/State/Tests/Pagination/PaginationTest.php (new).

The "after" and "before" cursors were base64-decoded and cast to int without
validation: a cursor of base64("-5") produced a negative offset (database
error) and a too large number produced a float returned from an int method
(TypeError), both ending in a 500. They now raise an InvalidArgumentException.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-01T08:06:01.206470Z
We couldn’t complete this review. Comment @codex review to try again.
4b63a3f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

1 participant