Skip to content

api: clamp public /api/prompts pagination parameters #1129

@kuishou68

Description

@kuishou68

Summary

The public GET /api/prompts endpoint currently parses page and perPage directly from query params without bounding them.

Impact

A client can request arbitrarily large perPage values (or malformed values) and force oversized database reads / response payloads on a public endpoint.

Reproduction

GET /api/prompts?perPage=1000000&page=1

Expected

  • page should be normalized to a sane positive integer
  • perPage should be clamped to a small public maximum
  • malformed values should fall back to defaults instead of propagating unexpected NaN / oversized values

Proposed fix

Add a small pagination parser for the public endpoint that defaults invalid values and clamps perPage to a public maximum.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions