Skip to content

Enforce pagination bounds on search list endpoints #1309

Description

@RUKAYAT-CODER

Overview

The list endpoints in src/search/search.controller.ts accept pagination parameters (page/limit/offset/cursor). Ensure a sane maximum page size is enforced and invalid values are rejected, so a client cannot request an unbounded number of rows (a memory/DoS and performance risk) or pass negative/non-numeric values.

Specifications

Features:

  • Page size is clamped to a documented maximum.
  • Invalid pagination values (negative, zero, non-numeric, over-max) are rejected with 400.
  • A consistent default page size is applied when none is provided.

Tasks:

  • Add/replace pagination inputs with a validated pagination DTO (class-validator: @IsInt, @Min, @Max) under src/search/dto.
  • Apply the DTO to the list handlers in src/search/search.controller.ts and clamp/validate the limit.
  • Document the default and maximum page size.

Impacted Files:

  • src/search/search.controller.ts
  • src/search/dto/ (pagination DTO)

Acceptance Criteria

  • Requesting an oversized limit is either clamped or rejected with 400 — never served unbounded.
  • Invalid pagination values return 400.
  • A default page size applies when parameters are omitted.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions