<!-- XE-16707 · [Medium] Unauthenticated list endpoints do full-table scans before pagination — /leases, /conflicts, /reputation, /directory · testnet -->
*Markdown view of <https://bounty.xe.network/XE-16707>. The page is the record; this is the same page for reading.*

XE-16707 · Bounty

# \[Medium\] Unauthenticated list endpoints do full-table scans before pagination — /leases, /conflicts, /reputation, /directory

Closed · duplicate
—claimed Medium
[xe#648](https://github.com/xeprotocol/xe/issues/648)
filed 2026-11-17 05:17 UTC
by kecedanzz77-bit

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-22 23:26 UTC

Told
:   2026-11-22 23:26 UTC

### Patches

None linked.

### History

- [770287](https://bounty.xe.network/log/770287) 2026-11-22 23:26 UTC reply.mirror\_failed
- [770112](https://bounty.xe.network/log/770112) 2026-11-22 23:26 UTC proposal.adopted
- [770111](https://bounty.xe.network/log/770111) 2026-11-22 23:26 UTC reply.sent
- [770110](https://bounty.xe.network/log/770110) 2026-11-22 23:26 UTC ticket.status new → closed
- [769357](https://bounty.xe.network/log/769357) 2026-11-22 23:26 UTC proposal.adopted
- [769356](https://bounty.xe.network/log/769356) 2026-11-22 23:26 UTC ticket.facts area
- [769355](https://bounty.xe.network/log/769355) 2026-11-22 23:26 UTC proposal.adopted
- [769354](https://bounty.xe.network/log/769354) 2026-11-22 23:26 UTC ticket.facts
- [769353](https://bounty.xe.network/log/769353) 2026-11-22 23:26 UTC proposal.adopted
- [769352](https://bounty.xe.network/log/769352) 2026-11-22 23:26 UTC ticket.facts
- [769351](https://bounty.xe.network/log/769351) 2026-11-22 23:26 UTC proposal.adopted
- [769350](https://bounty.xe.network/log/769350) 2026-11-22 23:26 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-16707) · [JSON](https://bounty.xe.network/v1/tickets/XE-16707) · [markdown](https://bounty.xe.network/XE-16707.md)

### Report

## Summary

The list handlers for `/leases`, `/conflicts`, `/reputation`, and `/directory` load and JSON-unmarshal every row from the store, then slice a page in memory. None of these routes has the `perClientLimit` wrapper \-- only `/accounts` and `/pending` do \-- so an unauthenticated client can fire full-scan requests at high rate with unbounded per-client concurrency. CPU/memory DoS on the node; cost scales with table size, not page size.

## Root Cause

- `handleGetAllConflicts` (`api/handler.go:772-775`): `paginateSlice(h.node.GetAllConflicts(), offset, limit)` \-- loads all conflicts.
- `handleGetLeases` (`api/handler.go:808-820`): `paginateSlice(h.node.GetLeases()/GetLeasesByState(state), offset, limit)` \-- loads all leases.
- `handleGetAllReputations` (`api/handler.go:904-907`): `paginateMap(h.node.GetAllReputations(), offset, limit)` \-- loads all reputations and sorts all keys (O(N log N)) per request.
- `/directory` (`api/directory.go:25-31`): same full-load pattern (bounded by the 50k registration cap).
- The store has no paginated query for leases, conflicts, or reputations (`store/badger_store.go` `GetAllLeases`/`GetLeasesByState`/`GetAllConflicts`/`GetAllReputations` take no limit).
- Only `/pending` (and `/accounts`) use `newPerClientLimit(maxHeavyListPerClient).wrap(...)` (`api/handler.go:169-170`); these endpoints have no per-client limit.

## Impact

CPU/memory DoS on the node. `/reputation` additionally sorts all keys per request. Leases/conflicts grow with chain activity, so the cost grows unboundedly.

## Verification (executed PoC)

After inserting 2,000 leases/conflicts/reputations into a `MemStore`, `GetAllLeases=2000 GetAllConflicts=2000 GetAllReputations=2000` \-- no limit parameter exists on any of them. Audited at HEAD `8cc209d` (testnet-0006).

## Note on related reports

Distinct endpoints from XE-0072 (`/accounts` \-- now cache-backed, appears fixed), XE-9108/XE-9121 (`/pending` \-- now uses `GetPendingPage`), #215 (`/frontiers` \-- now cache-backed via `GetFrontiersPage`). The same fix pattern was applied to those endpoints but not to these.

## Suggested fix

Add paginated store queries (or cache-backed pages like `/frontiers`), and apply the `perClientLimit` wrapper to these routes.

### Thread

**Joseph Denne**team2026-11-22 23:26 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-16707 and says what differs; it is read like any other.
