Skip to content

fix: enforce MAX_PAGE_SIZE=50 on all paginated queries (closes #82) - #88

Open
Jerry-Tekh wants to merge 3 commits into
ecotask-network:mainfrom
Jerry-Tekh:fix/issue-82-pagination-limit
Open

fix: enforce MAX_PAGE_SIZE=50 on all paginated queries (closes #82)#88
Jerry-Tekh wants to merge 3 commits into
ecotask-network:mainfrom
Jerry-Tekh:fix/issue-82-pagination-limit

Conversation

@Jerry-Tekh

Copy link
Copy Markdown

Closes #82

Fixes denial-of-service / budget-exhaustion vector where u32::MAX would iterate every task/verification in one transaction.

  • Add MAX_PAGE_SIZE constant (50) to task-registry and reward-engine storage
  • list_tasks rejects limit > 50 with descriptive panic
  • get_tasks_by_creator_paged rejects limit > 50 with descriptive panic
  • get_pending_verifications_paged rejects limit > 50 with descriptive panic
  • get_verifications_by_user rejects limit > 50 with descriptive panic
  • get_pending_verifications now iterates the pending list directly instead of delegating to collect_pending
  • Update existing tests to use valid limit values
  • Add should_panic tests confirming the cap is enforced

Jerry-Tekh and others added 3 commits August 26, 2026 15:54
- get_pending_verifications now panics immediately with 'engine: use get_pending_verifications_paged'
- Added deprecation doc comment pointing to paged variant
- Migrated all test references to get_pending_verifications_paged
- Updated CHANGELOG.md and README.md
- Add MAX_PAGE_SIZE constant (50) to task-registry and reward-engine storage
- list_tasks rejects limit > 50 with descriptive panic
- get_tasks_by_creator_paged rejects limit > 50 with descriptive panic
- get_pending_verifications_paged rejects limit > 50 with descriptive panic
- get_verifications_by_user rejects limit > 50 with descriptive panic
- get_pending_verifications now iterates the pending list directly
  instead of delegating to collect_pending, so the unbounded getter
  still returns every pending entry
- Update existing tests to use valid limit values
- Add should_panic tests confirming the cap is enforced

Fixes denial-of-service / budget-exhaustion vector where u32::MAX
would iterate every task/verification in one transaction.
- reward-engine: change get_pending_verifications_paged limits from 1000 to 50
- integration test: change get_pending_verifications_paged limit from 1000 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.

list_tasks has no MAX_LIMIT cap — a single call with limit=u32::MAX reads every task in the registry

1 participant