Skip to content

exclude PaginationRequest.maxLimit from client json binding - #1309

Open
kali834x wants to merge 1 commit into
apache:masterfrom
kali834x:pagination-maxlimit-binding
Open

kali834x wants to merge 1 commit into
apache:masterfrom
kali834x:pagination-maxlimit-binding

Conversation

@kali834x

Copy link
Copy Markdown
Contributor

PaginationRequest documents maxLimit as the server-enforced ceiling that getLimit() clamps a client-requested page size to, defaulting to 2000. The guard does not hold: the JSON-RPC receivers bind request parameters with Gson or Moshi, and both populate private fields by name, so the same request body the cap is supposed to constrain can also set the cap. A body of {"offset":0,"limit":999999,"maxLimit":999999} comes back with getLimit() returning 999999, which is the limit=999999 table-dump case the class javadoc and testEnterprise_maxLimitEnforced name as the reason the cap exists, and that value feeds straight into JPA setMaxResults. I noticed it while reading the clamp logic next to the wire-format docs, which list only offset and limit as client fields. Marking the field transient keeps it out of both binders while setMaxLimit() still works for service code, the only place the cap was meant to change. The new tests bind the hostile body through Gson and Moshi; both fail before the change and pass after.

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