Skip to content

[Server] Decode pagination cursor once in Registry - #37

Open
chr-hertel wants to merge 1 commit into
mainfrom
fix/issue-28-cursor-validation
Open

[Server] Decode pagination cursor once in Registry#37
chr-hertel wants to merge 1 commit into
mainfrom
fix/issue-28-cursor-validation

Conversation

@chr-hertel

Copy link
Copy Markdown
Owner

An invalid cursor threw InvalidCursorException in paginateResults() but was silently read as offset 0 in calculateNextCursor() — both decoding the same string in the same getTools() call.

The cursor is now decoded and validated once per list call in a new decodeCursor() helper; both paginateResults() and calculateNextCursor() receive the decoded offset. One validation policy: any malformed or out-of-bounds cursor throws.

Regression tests cover invalid cursors (non-base64, non-numeric, negative, out of bounds) across all four list methods plus a valid two-page walk.

Closes #28

Confidence: 9/10 — behavior for valid cursors is unchanged (verified by full unit suite), and the strict policy was already the externally observable one since paginateResults ran first.

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.

[C5] Cursor validation disagrees with itself

1 participant