mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-05 08:10:39 +00:00
CodeQL's rust/uncontrolled-allocation-size alert flagged `paginate_items` and the models list handler because `PaginationParams.offset: u32` was cast to `usize` without an upper bound and handed to `Iterator::skip`. In practice the underlying stores are bounded and `skip` on a Vec iterator is O(1), so the existing callers couldn't be coerced into allocating arbitrary memory, but an unbounded `offset` still takes an unbounded time to walk past and CodeQL had no way to see that. Clamp `offset` to `MAX_PAGE_OFFSET = 1_000_000` (beyond our largest expected run count by several orders of magnitude) in both the shared `paginate_items` helper and the models list handler that rolls its own pagination. `limit` was already clamped to 100. Closes code-scanning alert #27. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| crates | ||
| packages/fabro-api-client | ||