stability: enforce upper bounds on pagination params #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
pkg/paramsexposes pagination helpers (page,per_page) but doesn't capper_pageat a sane ceiling. Callers can request arbitrarily large pages, which (a) puts unnecessary load on the upstream Gitea instance and (b) can blow up the MCP response if a tool returns 1000+ records into a single message.Negative / zero values are also accepted in some paths instead of falling back to a default.
Suggested direction
ValidatePagination(page, perPage)helper inpkg/params1 <= pageand1 <= perPage <= 100(Gitea's typical max)