Skip to content

Commit ce1b46a

Browse files
committed
feat(lazy_heap): security hardening for LazyMinHeap
- Bound constructors with MAX_CAPACITY and add fallible try_with_capacity / try_reserve returning LazyMinHeapError (CapacityTooLarge / AllocationFailed) to prevent abort on oversized or untrusted capacity. - Guard stale-entry growth with an optional auto-rebuild factor (with_auto_rebuild / set_auto_rebuild) that runs maybe_rebuild after each update. - Protect the seq counter with checked_add and renumber live entries on imminent u64 overflow so stale heap entries can no longer satisfy the (score, seq) equality check. - Switch approx_bytes to saturating arithmetic to prevent overflow on pathological capacities. - Replace derived Debug with a redacted impl that reports only len / heap_len / seq / auto_rebuild_factor, eliminating key and score disclosure via tracing::debug!, dbg!, or panic backtraces. - Expand module docs with a Security Considerations section covering the above mitigations. Made-with: Cursor
1 parent 9021653 commit ce1b46a

1 file changed

Lines changed: 574 additions & 11 deletions

File tree

0 commit comments

Comments
 (0)