fix(webhooks): clamp delivery pagination ranges - #316
Conversation
Greptile SummaryThis PR replaces ad-hoc
Confidence Score: 5/5Safe to merge — the pagination helper is correct for all tested and untested edge cases, and the test suite is comprehensive. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["GET /api/webhooks/[id]/deliveries"] --> B["getAuthContext"]
B -- "null" --> C["401 Unauthorized"]
B -- "user" --> D["supabase.from('webhooks').select().eq().single()"]
D -- "not found" --> E["404 Not Found"]
D -- "user_id mismatch" --> F["403 Forbidden"]
D -- "ownership ok" --> G["parsePaginationParam(limit, 50, 1, 100)"]
G --> H["parsePaginationParam(offset, 0, 0, 100_000)"]
H --> I["supabase.from('webhook_deliveries').select().eq().order().range(offset, offset+limit-1)"]
I -- "error" --> J["400 Bad Request"]
I -- "success" --> K["200 {data, pagination}"]
Reviews (2): Last reviewed commit: "fix(webhooks): default empty delivery pa..." | Re-trigger Greptile |
Fixes #315.
Summary
limitandoffsetquery params through a bounded integer helper.range()Tests