You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bound All Work Triggered by a Single Token Selection Request [HIGH] #1641
Description
Conduct an architectural review of every code path reachable from a Selector.Select call -- token iteration depth, number of lock attempts, retry and back-off cycles, and lock-store growth -- and impose hard, configurable upper bounds on each dimension. Any request that would exceed these limits must be aborted early and all acquired locks released immediately. This is the primary defence against algorithmic attacks: no matter how a request is crafted (adversarial OwnerFilter, extreme quantity, or high concurrency), the system must shed load and return an error rather than consuming unbounded memory, CPU, storage, or wall-clock time.
Short Summary
An attacker can create a transaction that selects a large amount of tokens from database. This can exhaust the CPU and memory of the view service.
Hi @HayimShaul , @adecaro , I’d like to propose a structured approach to bound all work triggered by a Selector.Select request and prevent unbounded resource consumption.
1. Introduce a Selection Budget (Core Idea)
Define a per-request SelectionBudget that tracks and enforces limits across all dimensions:
maxTokensScanned
maxLockAttempts
maxRetries
maxDuration (wall-clock timeout)
maxLocksHeld
This budget is initialized at the start of Selector.Select and passed through all downstream calls.
Activity
SurbhiAgarwal1 commentedon May 4, 2026
Hi @HayimShaul , @adecaro , I’d like to propose a structured approach to bound all work triggered by a
Selector.Selectrequest and prevent unbounded resource consumption.1. Introduce a Selection Budget (Core Idea)
Define a per-request SelectionBudget that tracks and enforces limits across all dimensions:
This budget is initialized at the start of
Selector.Selectand passed through all downstream calls.