-
Notifications
You must be signed in to change notification settings - Fork 0
Closed as not planned
Description
Description
The Cloudflare CloudflareKvStore::list_keys implementation paginates through all keys in a KV namespace and accumulates them into a single Vec<String>. On namespaces with a large number of keys, this unbounded accumulation could cause an out-of-memory condition.
What needs to be done
Add a safety limit to list_keys pagination in crates/edgezero-adapter-cloudflare/src/key_value_store.rs:
- Cap the total number of keys returned (e.g., 10,000) or the total accumulated size
- Return a clear error when the limit is hit, rather than silently truncating
- Consider whether
list_keysshould accept an optional limit parameter at theKvStoretrait level
Done when
-
CloudflareKvStore::list_keyshas a configurable or hardcoded safety limit - Exceeding the limit returns a meaningful
KvError - Behavior is documented
Affected area
Adapter -- Cloudflare
Context
Identified during PR #165 (KV store feature) review. The current implementation works correctly for small namespaces but poses an OOM risk in production with large key sets.
Reactions are currently unavailable