Skip to content

Feature/issue 974 pagination validation#1103

Merged
Yunusabdul38 merged 3 commits into
Web3Novalabs:mainfrom
Dami24-hub:feature/issue-974-pagination-validation
Jun 2, 2026
Merged

Feature/issue 974 pagination validation#1103
Yunusabdul38 merged 3 commits into
Web3Novalabs:mainfrom
Dami24-hub:feature/issue-974-pagination-validation

Conversation

@Dami24-hub

Copy link
Copy Markdown
Contributor

Description

Resolves #974

This PR implements robust input validation for pagination query parameters (limit and offset) across the application's paginated endpoints. It ensures that incoming user data is safely typed and bounded before reaching the service layers, preventing potential DoS vectors (e.g., requesting massive limits) and database syntax errors.

Changes Checklist

  • Implemented input validation logic for pagination parameters.
  • Enforced boundaries: limit must be an integer between 1 and 100; offset must be a non-negative integer.
  • Added automated unit/integration tests covering edge cases.
  • Verified that all existing CI test suites pass successfully.
  • Updated relevant documentation/inline comments.

Proposed Changes

1. Validation Logic

  • Added checks to ensure limit and offset are valid integers.
  • Enforced upper-bound rule for pagination: limit <= 100.
  • Enforced lower-bound rule: limit > 0 and offset >= 0.
  • Configured the system to return a standard 400 Bad Request HTTP status code with a descriptive error payload when validation fails.

2. Testing Strategy

  • Valid Cases: Tested default pagination, explicit valid bounds (e.g., limit=50, offset=0), and maximum limit (limit=100).
  • Invalid Cases: Tested string injections (e.g., limit=abc), negative numbers (offset=-5), and exceeding the maximum threshold (limit=101).

Verification Results

Automated Tests

[PASTED_TEST_COMMAND_OUTPUT_HERE, e.g., "npm test" or "pytest" results]
All 24 existing tests passed.
5 new pagination validation tests passed successfully.

Checklist Before Requesting Review
[x] My code follows the code style guidelines of this project.

[x] I have performed a self-review of my own code.

[x] I have commented my code, particularly in hard-to-understand areas.

[x] My changes generate no new warnings or linting errors.

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

@Dami24-hub is attempting to deploy a commit to the shola's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 2, 2026

Copy link
Copy Markdown

@Dami24-hub Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Yunusabdul38 Yunusabdul38 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Yunusabdul38 Yunusabdul38 merged commit 7eb611e into Web3Novalabs:main Jun 2, 2026
0 of 3 checks passed
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.

Add input validation for pagination

2 participants