fix(marketplace): clamp listing page queries#321
Conversation
Greptile SummaryThis PR fixes a bug where invalid
Confidence Score: 5/5Safe to merge — the fix correctly bounds page inputs in both routes, and the regression tests verify the exact Supabase range arguments for all problematic input classes. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["GET /api/mcp or /api/skills\n?page=value"] --> B["parsePage(value)"]
B --> C{"value null/empty?"}
C -- yes --> D["use '1'"]
C -- no --> E["Number(value)"]
D --> E
E --> F{"Number.isFinite?"}
F -- no --> G["return 1"]
F -- yes --> H["Math.trunc(parsed)"]
H --> I["Math.max(1, truncated)"]
I --> J["Math.min(result, 100_000)"]
J --> K["page ∈ [1, 100_000]"]
K --> L["offset = (page - 1) × 20"]
L --> M["supabase.range(offset, offset + 19)"]
M --> N["200 OK"]
Reviews (2): Last reviewed commit: "fix(marketplace): cap listing page bound..." | Re-trigger Greptile |
Summary
Fixes #320.
Testing