{"id":"XE-0610","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":230,"title":"[Bundle] API consistency: GET /directory silently truncates to 100 of 217 entries (no total/cursor) + /chat/messages ignores every pagination parameter + chat inbox flooding evicts a victim's full his","area":"node-api","claimed_tier":"medium","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":true,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-05T06:20:13.087735+00:00","updated_at":"2026-11-11T10:14:48.949744+00:00","source_created_at":null,"told_at":"2026-11-08T20:18:47.263905+00:00","status_changed_at":"2026-11-08T20:18:21.300085+00:00","url":"https://bounty.xe.network/XE-0610","body":"# 🐞 Bug Report (Bug bounty — XE Protocol)\r\n\r\n## Summary\r\n\r\nThree live-verified API consistency/abuse findings on testnet-0005 (all tested with own registered accounts, ≤10 req/s, evidence transcripts retained):\r\n\r\n### 1. MEDIUM — `GET /directory` silently truncates to 100 of 217 entries\r\n\r\n`GET /directory` returns a **bare JSON array capped at 100 entries** with no total count, no cursor, no pagination parameters of its own that lift the cap. 217 accounts are registered (verified via per-account lookups); only the lexicographically-first 100 are ever returned — **117 accounts are permanently invisible to the list view** (they remain reachable via direct `GET /directory/{account}`). Related root cause to XE-0058 (known, capped list) but on this endpoint the cap is *silent*: no header, no field, no way for a consumer to know data is missing. Wallet UIs and indexers listing accounts will systematically miss the majority of the directory.\r\n\r\n### 2. LOW — `/chat/messages` ignores every pagination parameter\r\n\r\nWith a valid ownership proof (4-message inbox), **12 parameter variants** were tested: `limit=1&offset=0..3`, `limit=2&offset=3`, `offset=-1`, `offset=-99999999999`, `limit=0`, `limit=-1`, `limit=999999`, `offset=9223372036854775807`, `offset=18446744073709551616`, `limit=abc`, `offset=abc`, `since=-5`, `since=99999999999999999999999` — **every variant → 200 with the full inbox**. Parameters are silently swallowed (contrast: `/directory` where limit/offset work, and `/pending//accounts` where they cap at 100). No 500s, no type-name leaks — robust input handling, absent semantics. Impact: unbounded-by-params response size on an authenticated endpoint (self-DoS only) + inconsistent pagination contract across three endpoint families. Pairs with #1 as one pagination-contract theme.\r\n\r\n### 3. LOW — chat inbox flooding: one IP can evict a victim's full 1000-msg history in ~100 s and pollute their contact list\r\n\r\nChat has **no per-account rate limit**: the only brakes are the per-IP write bucket (10 req/s, burst 50 — `api/handler.go:295-298`) and per-message PoW (blake2b-8 at 2^-14 ≈ trivial in Go). Live-proven on own accounts (S3/S3b): 1,000 rapid messages → **1000×200, zero 429s**; recipient's 1000-cap FIFO evicts their entire prior history in ~100 seconds, and the sender's address is injected into the victim's derived contact list (contacts are derived from stored envelopes; no contact-mutation API exists, no removal possible). Adjacent code-only issues: the seen-ID map (100k entries, ~10 min aging) can be exhausted to block **all** new chat on a node (`400 duplicate envelope` misnomer), and the P2P chat ingress stores envelopes addressed to *any* account string (no homing check) — enabling third-party mailbox stuffing without connecting to the victim's node.\r\n\r\n## Steps to Reproduce\r\n\r\n1. (F1) Register ≥101 accounts via `POST /directory/register`; `GET /directory` → exactly 100 entries, no indication of truncation; `GET /directory/{account}` for entry #217 → 200 (it exists, it's just not listed).\r\n2. (F2) Authenticate to `/chat/messages` with a valid proof; append `?limit=1&offset=0`, then `?limit=abc`, `?offset=-1`, etc. → all return the full inbox.\r\n3. (F3) Register sender+victim; send 1,000 messages (PoW per message; ≤10 req/s sustained) → victim's pre-existing messages evicted FIFO; victim's `GET /chat/contacts` now contains the sender.\r\n\r\n## Impact\r\n\r\n- F1: directory consumers (wallet UIs, indexers, monitoring) silently operate on 45% of the data — integrity of public directory views.\r\n- F2: inconsistent API contract; unbounded responses.\r\n- F3: targeted history-wipe + contact pollution of any account by a single IP; node-wide chat DoS via seen-map exhaustion (code-only).\r\n\r\n## Suggested fix\r\n\r\n- F1: return `{entries, total, next_cursor}` (or an explicit truncation flag); document the cap.\r\n- F2: parse+enforce `limit`/`offset`/`since` on `/chat/messages` (or reject unknown params with 400) — one shared pagination helper for all list endpoints.\r\n- F3: per-account send rate limit (independent of the IP bucket); consider a contact-visibility rule (only derive contacts from received messages above a threshold, or allow contact removal); add a homing check on P2P chat ingress (drop envelopes addressed to unknown accounts).","patch_refs":[],"thread":[{"id":1105,"source":"desk","source_ref":"reply:655","author":"Joseph Denne","team":true,"body":"Thanks for the bundle. The inbox-flooding item is already on file from an earlier report and will be handled there; the two pagination items are being reviewed as API consistency work. We will update you here: https://bounty.xe.network/XE-0610","created_at":"2026-11-08T20:17:41.885067+00:00"}]}