{"id":"XE-13354","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"499","source_url":"https://github.com/xeprotocol/xe/issues/499","reporter_id":1981,"title":"Report bug","area":"node-api","claimed_tier":null,"assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-14T20:42:10.445969+00:00","updated_at":"2026-11-20T00:38:17.995211+00:00","source_created_at":"2026-11-12T03:50:05+00:00","told_at":"2026-11-20T00:34:59+00:00","status_changed_at":"2026-11-20T00:34:14.649147+00:00","url":"https://bounty.xe.network/XE-13354","body":"# XE Bounty — Laporan siap file (temuan pass 4 #4)\n\nFile issue baru di: https://github.com/xeprotocol/xe/issues/new\nPaste judul + isi di bawah. Akun GitHub: Gib230223.\n\n---\n\n## Judul\n\n[Low] ChatStore panics when constructed with maxPerAccount <= 0\n\n## Isi\n\n## Summary\n\n`chat.NewChatStore(maxPerAccount)` takes the bound with no validation, and `storeFor` indexes `newMsgs[s.maxPerAccount-1]` whenever `len(msgs) >= s.maxPerAccount`. With `maxPerAccount == 0`, `len(msgs) >= 0` is always true, so the first `Store` panics; with a negative value, `make` panics. An exported constructor that panics on a plausible misconfiguration.\n\n## Evidence\n\n```go\n// chat/chat.go:21 — no validation of the bound:\nfunc NewChatStore(maxPerAccount int) *ChatStore {\n    return &ChatStore{\n        messages:      make(map[string][]*Envelope),\n        seen:          make(map[string]int64),\n        maxPerAccount: maxPerAccount,\n        listeners:     make([]chan *Envelope, 0),\n    }\n}\n\n// chat/chat.go:72-83 — storeFor panics on maxPerAccount <= 0:\nfunc (s *ChatStore) storeFor(account string, env *Envelope) {\n    msgs := s.messages[account]\n    if len(msgs) >= s.maxPerAccount {\n        newMsgs := make([]*Envelope, s.maxPerAccount)\n        copy(newMsgs, msgs[1:])\n        newMsgs[s.maxPerAccount-1] = env\n        s.messages[account] = newMsgs\n    } else {\n        s.messages[account] = append(msgs, env)\n    }\n}\n```\n\n## Impact (Low, latent)\n\nThe only production caller passes 1000 (`node/node.go:314`: `chat.NewChatStore(1000)`), so there is no live production path today. Robustness / defense-in-depth: an exported constructor that panics on a plausible misconfiguration; one-line fix (clamp `maxPerAccount` to >= 1 in `NewChatStore`).\n\n## Reproduction (PoC)\n\n`TestPoc4ChatStoreZeroMaxPanics` (package `chat`):\n\n```\nmaxPerAccount=0: Store panicked as expected: runtime error: slice bounds out of range [1:0]\nmaxPerAccount=-1: Store panicked as expected: runtime error: makeslice: len out of range\n```\n\n## Novelty note\n\nNo ticket covers the zero/negative-bound panic. Board greps for `maxPerAccount`, `ChatStore panic` return only XE-7038 (ChatStore dedup-set saturation halts all chat ingestion — a different mechanism, about the dedup set filling up, not the bound). GitHub `search_issues` for \"ChatStore maxPerAccount panic\" returns 0 results; the closest are #269 (flooding eviction — the rotation itself) and #256 (ANSI escapes) — neither is the zero/negative-bound panic. Checked the live bounty board (High+Medium and Minor views) and the GitHub repo issues, 2026-11-12.\n\nRepo: github.com/xeprotocol/xe, HEAD 89a542e, testnet-0005.\n","patch_refs":[{"id":565,"repo":"xeprotocol/xe","kind":"pr","ref":"519","title":"fix(chat): clamp maxPerAccount and defensively guard against slice panics (fixes #499)","url":"https://github.com/xeprotocol/xe/pull/519","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-11-14T20:42:20.183992+00:00"}],"thread":[{"id":13289,"source":"github","source_ref":"7026489965","author":"Joseph Denne","team":true,"body":"Thanks for the report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.","created_at":"2026-11-20T00:34:59+00:00"},{"id":17513,"source":"github","source_ref":"7063282442","author":"Tsaqifalk","team":false,"body":"Omaga","created_at":"2026-11-21T13:26:59+00:00"},{"id":17581,"source":"github","source_ref":"7063527908","author":"rhnhabibi","team":false,"body":"jangan asal timpa mas reportnya dibaca dulu xixixi","created_at":"2026-11-21T13:43:33+00:00"},{"id":17597,"source":"github","source_ref":"7063572744","author":"ddettaa","team":false,"body":"😹😹","created_at":"2026-11-21T13:46:34+00:00"},{"id":17598,"source":"github","source_ref":"7063582241","author":"rhnhabibi","team":false,"body":"lucu bgt loh rek lupa masih bahasa indo","created_at":"2026-11-21T13:47:17+00:00"},{"id":17599,"source":"github","source_ref":"7063592271","author":"Gib230223","team":false,"body":"Mana saya tau saya nyuruh Muse yang ngerjain\r\n\r\nPada Sab, 21 Nov 2026, 20.43, rhnhabibi ***@***.***> menulis:\r\n\r\n> *rhnhabibi* left a comment (xeprotocol/xe#499)\r\n> <https://github.com/xeprotocol/xe/issues/499#issuecomment-7063527908>\r\n>\r\n> jangan asal timpa mas reportnya dibaca dulu xixixi\r\n>\r\n> —\r\n> Reply to this email directly, view it on GitHub\r\n> <https://github.com/xeprotocol/xe/issues/499?email_source=notifications&email_token=BQY7MN6LYJEUKMMVHGIEAQT52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7063527908>,\r\n> or unsubscribe\r\n> <https://github.com/notifications/unsubscribe-auth/BQY7MN5XET5QRHFTJZQKW7T52GLZZAVCNFSNUABGKJSXA33TNF2G64TZHMYTGMRVGI2TCNBSGE5US43TOVSTWNRTGQZDGNRSGA4DPILWAI>\r\n> .\r\n> Triage notifications, keep track of coding agent tasks and review pull\r\n> requests on the go with GitHub Mobile for iOS\r\n> <https://github.com/notifications/mobile/ios/BQY7MN7CO6GSJ34K2JZD3TT52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>\r\n> and Android\r\n> <https://github.com/notifications/mobile/android/BQY7MN6VZRZ7MELLG7IUE6T52GLZZA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TENZZGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.\r\n> Download it today!\r\n> You are receiving this because you authored the thread.Message ID:\r\n> ***@***.***>\r\n>","created_at":"2026-11-21T13:48:05+00:00"},{"id":17600,"source":"github","source_ref":"7063599100","author":"Gib230223","team":false,"body":"Maksud\r\n\r\nPada Sab, 21 Nov 2026, 20.47, rhnhabibi ***@***.***> menulis:\r\n\r\n> *rhnhabibi* left a comment (xeprotocol/xe#499)\r\n> <https://github.com/xeprotocol/xe/issues/499#issuecomment-7063582241>\r\n>\r\n> lucu bgt loh rek lupa masih bahasa indo\r\n>\r\n> —\r\n> Reply to this email directly, view it on GitHub\r\n> <https://github.com/xeprotocol/xe/issues/499?email_source=notifications&email_token=BQY7MN2X2VWUY6LA6CN3F6L52GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7063582241>,\r\n> or unsubscribe\r\n> <https://github.com/notifications/unsubscribe-auth/BQY7MN4ZMCBU3VAJDK2HZLT52GMH3AVCNFSNUABGKJSXA33TNF2G64TZHMYTGMRVGI2TCNBSGE5US43TOVSTWNRTGQZDGNRSGA4DPILWAI>\r\n> .\r\n> Triage notifications, keep track of coding agent tasks and review pull\r\n> requests on the go with GitHub Mobile for iOS\r\n> <https://github.com/notifications/mobile/ios/BQY7MN5TZGLJTL5TNAFWTK352GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG>\r\n> and Android\r\n> <https://github.com/notifications/mobile/android/BQY7MN24NEUOMYIC4NZDJ7D52GMH3A5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMBWGM2TQMRSGQY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.\r\n> Download it today!\r\n> You are receiving this because you authored the thread.Message ID:\r\n> ***@***.***>\r\n>","created_at":"2026-11-21T13:48:39+00:00"},{"id":17601,"source":"github","source_ref":"7063657464","author":"Creepzone11","team":false,"body":"> Thanks for the report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.\n> \n> XE-13354 · https://bounty.xe.network/XE-13354\n\nNjing","created_at":"2026-11-21T13:53:15+00:00"},{"id":17602,"source":"github","source_ref":"7063739935","author":"Gib230223","team":false,"body":"Wey ko pada ngumpul disini cok","created_at":"2026-11-21T13:59:52+00:00"},{"id":17603,"source":"github","source_ref":"7063745428","author":"supercherki","team":false,"body":"muse saya setara nasa, kamu tidak bisa mengelak","created_at":"2026-11-21T14:00:17+00:00"},{"id":17604,"source":"github","source_ref":"7063766139","author":"Gib230223","team":false,"body":"Heleh Muse plenger","created_at":"2026-11-21T14:01:50+00:00"},{"id":17605,"source":"github","source_ref":"7063902300","author":"arashel666","team":false,"body":"kalo nimpa dipikir mas","created_at":"2026-11-21T14:12:12+00:00"},{"id":17606,"source":"github","source_ref":"7063924555","author":"Gib230223","team":false,"body":"Loh gua nimpa punya siapa gua ajh nuyuruh Muse malah d bilang nimpa kocak","created_at":"2026-11-21T14:13:48+00:00"},{"id":17608,"source":"github","source_ref":"7063999800","author":"erisaerisul","team":false,"body":"saya adalah muse spark sahabat pemerintah","created_at":"2026-11-21T14:19:48+00:00"},{"id":17926,"source":"github","source_ref":"7066504832","author":"mmasyoga0","team":false,"body":"Ngerii","created_at":"2026-11-21T17:28:11+00:00"}]}