{"id":"XE-10208","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"Silent Protocol Failure: Client SDK methods omit HTTP status validation masking server errors as empty state","area":"sdk-docs-web","claimed_tier":null,"assessed_tier":null,"verdict":"duplicate","duplicate_of":"XE-0121","tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"duplicate","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-12T10:53:59.241204+00:00","updated_at":"2026-11-20T00:33:19.905846+00:00","source_created_at":null,"told_at":"2026-11-20T00:33:19.923381+00:00","status_changed_at":"2026-11-20T00:33:19.913539+00:00","url":"https://bounty.xe.network/XE-10208","body":"## Vulnerability Summary\n\nIn `client/client.go:35-152`, the official Go client SDK provides wrapper methods for communicating with XE network nodes. Multiple key methods (`GetChain`, `GetBalances`, `GetPending`, `GetProviders`, `GetLeases`) ignore `resp.StatusCode` completely:\n\n```go\nfunc (c *Client) GetChain(addr string) ([]*core.Block, error) {\n...\n\t\tresp, err := http.Get(url)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvar result struct {\n\t\t\tBlocks []*core.Block `json:\"blocks\"`\n\t\t\tTotal  int           `json:\"total\"`\n\t\t}\n\t\terr = json.NewDecoder(resp.Body).Decode(&result)\n\t\t_ = resp.Body.Close()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tall = append(all, result.Blocks...)\n...\n}\n\nfunc (c *Client) GetBalances(addr string) (map[string]uint64, error) {\n\tresp, err := http.Get(fmt.Sprintf(\"%s/accounts/%s/balance\", c.BaseURL, addr))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\tvar result struct {\n\t\tBalances map[string]uint64 `json:\"balances\"`\n\t}\n\t_ = json.NewDecoder(resp.Body).Decode(&result)\n\tif result.Balances == nil {\n\t\treturn map[string]uint64{}, nil\n\t}\n\treturn result.Balances, nil\n}\n```\n\nCritical architectural flaw:\n1. Status Code Omission: When the node returns non-200 responses (e.g. `500 Internal Server Error`, `502 Bad Gateway`, `503 Service Unavailable`, or `429 Too Many Requests`), `resp.StatusCode` is never checked.\n2. Silent Failure as Empty State: The JSON error body (e.g. `{\"error\":\"...\"}`) fails to unmarshal into the expected payload struct fields (`result.Blocks`, `result.Balances`, `result.Pending`), resulting in empty or zero-value structs with `err == nil`.\n3. Downstream CLI & Application Misbehavior:\n   - In `cmd/xe/main.go:699-703` (`cmdSend`), an upstream 503 or 429 response causes `GetBalances` to return `map[string]uint64{}`, misleading the user with a false \"insufficient balance\" error.\n   - In `cmd/xe/main.go:740-745` (`cmdReceive`), a node error during `GetPending` causes the CLI to report \"No pending sends to receive\", masking uncollected funds.\n   - In `GetChain`, an HTTP 404 or 500 response returns an empty slice with no error, causing downstream callers to mistakenly assume the account is uninitialized and forge a new genesis block with `Previous = \"0\"`.\n\n## Proposed Remediation\n\nIn `client/client.go`, enforce status checks across all HTTP request methods before unmarshaling:\n```go\n\tif resp.StatusCode != http.StatusOK {\n\t\tbody, _ := io.ReadAll(resp.Body)\n\t\treturn nil, fmt.Errorf(\"HTTP %d: %s\", resp.StatusCode, strings.TrimSpace(string(body)))\n\t}\n```","patch_refs":[],"thread":[{"id":13239,"source":"desk","source_ref":"reply:11261","author":"Joseph Denne","team":true,"body":"Thanks. This is the same finding as https://bounty.xe.network/XE-0121, which was filed first; the programme pays the\nfirst verifiable submission, so this one closes as a duplicate. If you believe it is a different\nbug, file a new report that links https://bounty.xe.network/XE-10208 and says what differs; it is read like any other.","created_at":"2026-11-20T00:33:19.905846+00:00"}]}