GET /frontiers offset paging skips and duplicates accounts when a new account sorts in mid-walk (no cursor, no snapshot)
Report
Summary
GET /frontiers pages with a numeric offset over a list sorted by account address. The address is immutable, so the order is deterministic at rest — but the key set is not: every new account sorts into the list, and the cached order is discarded whenever any account is dirty. A new account sorting in before the walk's current offset shifts every later entry by one, so a consumer walking the enumeration silently misses one account and counts another twice. There is no snapshot, no cursor, and no total anywhere in the path, so the loss is undetectable.
This is the GET /frontiers instance of the offset-paging defect class filed as XE-17296 for GET /pending and XE-17331 for GET /accounts — but with its own trigger: key-set insertion into an immutable-key sort, not a mutable-value re-sort.
Target
- Repo:
xeprotocol/xe@8cc209d65c16089158da8fabd392628b71fe0711(remote HEAD, verified 2026-11-17). - Files:
api/handler.go:766-769(handleGetFrontiers),node/node.go:1008-1026(GetFrontiersPage),core/account_summary.go:125-135(AccountsByAddress),:40-73(refreshSummariesLocked),api/handler.go:640-656(parsePagination).
Code path
handleGetFrontiers calls parsePagination then h.node.GetFrontiersPage(offset, limit). GetFrontiersPage takes n.Ledger.AccountsByAddress(), slices all[offset:end]. AccountsByAddress returns a list sorted by strings.Compare(a.Account, b.Account) (address: immutable key), cached in summaryByID, but refreshSummariesLocked rebuilds summaries whenever any account is dirty and ends with l.summaryByXE, l.summaryByID = nil, nil, discarding the cached order. Each page request therefore materialises a fresh sorted list of the live account set and slices it by numeric offset. A new account created between page N and page N+1 sorts into the list before the walk's offset and shifts every entry after it by one: the walk returns the boundary account twice and never returns the account that was pushed past the end of the walk. parsePagination takes only offset/limit; no cursor parameter exists anywhere in the frontiers path.
Reproduction (read-only, no crafted input)
GET https://test.network/api/v1/frontiers?limit=50&offset=0— 50 frontiers, strictly address-ascending (verified live 2026-11-17: page 0 ends09dadfd6…, page 1 begins09e2d306…).- Wait for a new account to be created, then
GET .../frontiers?limit=50&offset=50. - Diff the boundary: if the new account's address sorts before the offset-50 boundary, the boundary account appears in both pages and the last account of the walk is never returned. Live scale on testnet-0006 (2026-11-17): 1,307 accounts at the previous cycle, 1,367 by this cycle's check — new accounts sort in constantly, so the hazard is exercised on every multi-page walk that spans an account creation.
Impact
Medium — same class and tier as XE-17296 and XE-17331. No direct fund loss: the defect corrupts enumeration, not frontiers. Anyone paginating /frontiers — explorers, indexers, sync clients reconciling frontier state — silently misses accounts or counts them twice, with no total to detect the loss. The trigger is the network's normal operation (account creation), not an attacker action.
Suggested fix
Snapshot the sorted list under summaryMu for the duration of a walk, or add a keyset cursor (the sort key — account address — is already total), or at minimum return a total plus a stable-ordering guarantee so consumers can detect a shifted walk.
Distinctness
- XE-17296 (Medium) is
GET /pendingonly — different endpoint, different store and trigger (pending-set insert/delete vs account-set insertion into an address sort). - XE-17331 (Medium, ours) is
GET /accounts— different endpoint and a strictly stronger trigger (re-sort on every balance change anywhere on the network). Its body does not mention/frontiers. - XE-17327 / XE-17339 (Medium) are
GET /leasesandGET /conflicts— different endpoints, and a different mechanism: unsorted Go-map ranges reshuffle on every request even with zero mutation. That mechanism does NOT apply here:AccountsByAddresssorts deterministically, so/frontiersis stable at rest and shifts only on key-set insertion. - XE-16443 (High) is the five endpoints loading the full collection before paginating — a performance defect (cost), not a correctness defect (wrong enumeration). Different mechanism, different fix.
- XE-0058 / XE-14068 are silent truncation (bare array, no
total, 100-item default) — a detection problem, not the skip/duplicate mechanism. The missingtotalis cited here only as why the loss is undetectable. - XE-11844 (Minor, docs) claims
/accountspaging IS stable because the handler sorts before slicing — the same at-rest-only reasoning would wrongly clear/frontierstoo; it does not consider the concurrent-mutation case at all. - Corpus searches over all 2,885 public tickets:
offset/cursor/pagination/frontiers— no ticket names an offset-paging skip/duplicate on/frontiers.
Honest limitations
- Live observation: two back-to-back two-page walks (limit 50, ~60 s apart, 2026-11-17) showed no shift — the boundary accounts were unchanged inside that window, because the new accounts created in that window sorted after the offset-50 boundary. The defect is proven in code (fresh sorted list per page + offset slicing with no snapshot), and the shift requires an insertion sorting before the walk's offset; on a growing network it is routine over a full 27-page walk at the default limit. No live skip/duplicate was captured in this run.
- The walk is 14 pages at limit 100; the hazard needs an insertion before the walk's offset, so a single walk may or may not exhibit it — the defect is in the paging contract, not in any single response.
Reporter
XE address: db4043dea0d12c476c2644a3df09c4ce51fa1ce04617723405916ade3fa3305f
Thread
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-17372 and says what differs; it is read like any other.