{"id":"XE-0934","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":13,"title":"SDK per-request timeout does not cover the response-body read","area":"sdk-docs-web","claimed_tier":"minor","assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"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-06T18:47:15.281130+00:00","updated_at":"2026-11-08T20:17:41.885067+00:00","source_created_at":null,"told_at":"2026-11-08T20:18:46.741279+00:00","status_changed_at":"2026-11-08T20:18:18.926514+00:00","url":"https://bounty.xe.network/XE-0934","body":"## Summary\r\nXeClient is supposed to bound every HTTP call with timeoutMs so a stuck peer cannot pin a job. At sdk/src/client.ts:164-182, #once attaches AbortSignal to fetch, then clearTimeout(timer) in a finally after headers return, then await res.text() with no remaining deadline. A peer that answers headers and never finishes the body therefore hangs past the configured timeout: with timeoutMs=250 the request was still pending at 1003 ms, while a control fast body completed in 40 ms. Any SDK request() to a node or provider URL takes this path. GitHub #44 is sync page OOM; this is the SDK HTTP client dropping the deadline before the body read.\r\n\r\n## Affected components\r\nsdk/src/client.ts:164-182 XeClient #once (AbortSignal cleared after headers, res.text() unbounded) at sdk 0dbc92ecff709bee79768e4e37788c682a0f4525.\r\n\r\n## Impact\r\nA peer that answers headers and never finishes the body pins the caller's job for as long as the process lives. A call that should fail in 250 ms was still pending at 1003 ms. No data corruption; the hang is the whole impact.\r\n\r\n## PoC\r\n\r\n```javascript\r\n#!/usr/bin/env node\r\n/** A5 — per-request timeout does not cover the response-body read. */\r\nimport { XeClient } from './sdk.mjs'\r\n\r\nconst PIN = '0dbc92ecff709bee79768e4e37788c682a0f4525'\r\nconst TIMEOUT_MS = 250\r\nconsole.log(`PROVENANCE: sdk=${PIN} file=poc/round3/a5_timeout_body.mjs timeoutMs=${TIMEOUT_MS}`)\r\n\r\nfunction hangingFetch() {\r\n  return async (url, init) => {\r\n    const stream = new ReadableStream({\r\n      start() {\r\n        /* headers ready, body never arrives */\r\n      },\r\n    })\r\n    return new Response(stream, { status: 200, headers: { 'content-type': 'application/json' } })\r\n  }\r\n}\r\n\r\nfunction fastFetch(body) {\r\n  return async () => new Response(body, { status: 200, headers: { 'content-type': 'application/json' } })\r\n}\r\n\r\nconst ctrl = new XeClient({ url: 'http://127.0.0.1', timeoutMs: TIMEOUT_MS, retries: 0, fetch: fastFetch('{\"ok\":true}') })\r\nconst t0 = Date.now()\r\nconst ctrlBody = await ctrl.request('/ok')\r\nconst ctrlMs = Date.now() - t0\r\nconsole.log(`CONTROL fast body ms=${ctrlMs} body=${JSON.stringify(ctrlBody)}`)\r\n\r\nconst atk = new XeClient({ url: 'http://127.0.0.1', timeoutMs: TIMEOUT_MS, retries: 0, fetch: hangingFetch() })\r\nconst waitMs = TIMEOUT_MS * 4\r\nconst t1 = Date.now()\r\nconst raced = await Promise.race([\r\n  atk.request('/stall').then(\r\n    (v) => ({ done: 'resolved', v, ms: Date.now() - t1 }),\r\n    (e) => ({ done: 'rejected', v: String(e), ms: Date.now() - t1 }),\r\n  ),\r\n  new Promise((r) => setTimeout(() => r({ done: 'still_pending', v: null, ms: Date.now() - t1 }), waitMs)),\r\n])\r\nconsole.log(`ATTACK hang-body after ${waitMs}ms: ${JSON.stringify(raced)}`)\r\n\r\nif (ctrlBody && ctrlBody.ok === true && raced.done === 'still_pending' && raced.ms >= waitMs - 20) {\r\n  console.log(`PASS: SDK still pending ${raced.ms}ms after timeoutMs=${TIMEOUT_MS}; CONTROL completed in ${ctrlMs}ms`)\r\n  console.log('VERDICT=CONFIRMED')\r\n  process.exit(0)\r\n}\r\nconsole.log(`KILL: control ms=${ctrlMs} attack=${JSON.stringify(raced)}`)\r\nconsole.log('VERDICT=KILLED')\r\nprocess.exit(0)\r\n```\r\n\r\n```\r\nCONTROL fast body ms=40 body={\"ok\":true}\r\nATTACK hang-body after 1000ms: {\"done\":\"still_pending\",\"v\":null,\"ms\":1003}\r\nPASS: SDK still pending 1003ms after timeoutMs=250\r\n```\r\n\r\n## Suggested fix\r\nKeep AbortSignal armed through res.text(), not only through headers. Do not clear the timer until the body read finishes or aborts.\r\n---","patch_refs":[],"thread":[{"id":1096,"source":"desk","source_ref":"reply:645","author":"Joseph Denne","team":true,"body":"Thanks for the report. We have confirmed the behaviour from the code and it is being handled; we will update https://bounty.xe.network/XE-0934 when a fix lands.","created_at":"2026-11-08T20:17:41.885067+00:00"}]}