fix(thread-ownership): bound 409 conflict JSON response read#98937
fix(thread-ownership): bound 409 conflict JSON response read#98937ajwan8998 wants to merge 5 commits into
Conversation
Replace unbounded resp.json() with readProviderJsonResponse which enforces the standard 16 MiB provider JSON cap.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: the narrow thread-ownership fix is valid, but #98941 is open, mergeable, proof-positive, and carries the same bounded 409 conflict handling plus a regression test as the canonical landing path. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this narrow branch and keep review on #98941 unless maintainers explicitly choose a smaller thread-ownership-only landing path. So I’m closing this here and keeping the remaining discussion on #98941. Review detailsBest possible solution: Close this narrow branch and keep review on #98941 unless maintainers explicitly choose a smaller thread-ownership-only landing path. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main still uses native resp.json() in the 409 ownership-conflict path, and the PR body includes live loopback output showing before/after oversized-response behavior; this read-only review did not run tests. Is this the best way to solve the issue? Yes for the narrow production fix, but not as the best item to keep open. The same central fix is already in the open, mergeable, proof-positive canonical PR, so maintainer review should converge there. Security review: Security review cleared: No supply-chain, workflow, dependency, secret, or permission changes are present; the diff reduces an unbounded response-read memory-exhaustion risk. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 4f933ccf7b62. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
When the 409 conflict body exceeds the 16 MiB read cap, preserve
{ cancel: true } instead of falling through to fail-open catch.
Owner info is best-effort; cancellation is not.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
thread-ownershipplugin reads 409 conflict responses from its forwarder API with an unboundedresponse.json(). A compromised or misconfigured forwarder endpoint could return an arbitrarily large error body, causing OOM during the ownership check path.The 409 error body is expected to be small (just
{ owner: "..." }), but the unbounded read is an unnecessary risk on a path that runs for every outbound Slack thread message.Changes
extensions/thread-ownership/index.ts: replace unboundedresp.json()withreadProviderJsonResponse(16 MiB cap viareadResponseWithLimit).Real behavior proof
node:httpserver on127.0.0.1, Node v24.Tests:
node scripts/run-vitest.mjs extensions/thread-ownership/index.test.ts --run→ passed (1 pre-existing failure, unrelated).Evidence
What was not tested: End-to-end with real Slack forwarder (requires network). The
node:httploopback proof covers transport and cancellation behavior.