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
[BUG] maxFilterValues setting is advertised in NIP-11 but never enforced #599
Describe the bug
The relay defines limits.client.subscription.maxFilterValues (default: 2500) in settings, but this value is never checked anywhere in the codebase. A client can send a filter with 5,000+ values in authors, ids, #e, #p, etc., and the relay passes them straight to PostgreSQL as a WHERE IN (...) clause.
In EventRepository.findByFilters() (src/repositories/event-repository.ts):
No length validation happens before this call. The setting only exists as a type definition in src/@types/settings.ts - it is never imported or read by any handler or repository.
To Reproduce
Steps to reproduce the behavior:
Start nostream with default settings (maxFilterValues: 2500)
grep -rn 'maxFilterValues' src/ --include='*.ts' returns only @types/settings.ts:109 - zero enforcement anywhere
Impact: Postgres builds a hash table for the oversized IN clause, spiking CPU and memory. Concurrent requests like this are a straightforward DoS vector.
Activity