Repository navigation
fix(nextcloud-talk): reject excess concurrent webhook reads - #146356
Conversation
Acquire a listener-owned in-flight limiter slot before the unauthenticated webhook body read, reject overflow with a close-aware HTTP 429, and release the slot after signature verification but before authenticated dispatch. Incomplete requests previously pinned a pre-auth reader for the full timeout without consuming the authentication-failure budget, letting any reachable client hold unbounded numbers of sockets and readers to degrade webhook availability. This follows the owner-level pattern merged for SMS (#136504) and Feishu (#137230).
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 12, 2026, 7:58 PM ET / 23:58 UTC (Revision 7). ClawSweeper reviewWhat this changesCaps Nextcloud Talk’s unauthenticated webhook reads at 64, closes overflow requests with HTTP 429, preserves acknowledgement ordering, and documents the shared plugin API. Merge readiness⛔ Blocked before merge - 4 items remain The PR remains useful: current main still lacks this bound, and the prior ordering and documentation findings are resolved. The author’s explicit operator acceptance does not settle the outstanding maintainer decision. Priority: P2 Review scores
Verification
How this fits togetherNextcloud Talk sends signed HTTP events to a plugin-owned listener. The listener reads and authenticates each event before handing it to durable storage and acknowledging acceptance. flowchart TD
A[Nextcloud webhook requests] --> B[Order requests per connection]
B --> C{Read capacity available?}
C -->|No| D[429 and connection close]
C -->|Yes| E[Read body and verify signature]
E --> F[Release read capacity]
F --> G[Store authenticated event]
G --> H[Send durable acknowledgement]
Decision needed
Why: Production-boundary proof supports the implementation, but operator acceptance cannot establish the repository’s delivery tradeoff or public API commitment. Before merge
Agent review detailsSecurityNone. PR surfaceSource +54, Tests +258, Docs +13, Other +2. Total +327 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the shared bounded-admission and ordered-response design with an explicitly accepted overload policy and supported SDK contract. Do we have a high-confidence way to reproduce the issue? Yes, for the missing concurrency bound: current source admits incomplete bodies without an aggregate limit, and supplied TCP evidence exercises that path. Actual resource starvation was not independently reproduced. Is this the best way to solve the issue? Yes, the implementation reuses the existing limiter and connection lifecycle at the owning listener; selecting the overload response and accepting possible delivery loss remain maintainer judgments. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a0792d71e5b4. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
… overflow Serialize webhook admission per connection through the shared HTTP request lifecycle (runHttpConnectionRequest, re-exported on the plugin SDK guards subpath) so a pipelined request's overflow rejection only starts after every earlier response on the connection finished. Covers the reviewed sequence with real TCP: a saturated keep-alive connection with admission pending past the one-second close timer must still deliver the earlier signed 200 before the close-aware 429.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…ordering Record the 64-slot admission bound, its close-aware 429 overflow behavior, ordered keep-alive acknowledgements, and the unverified sender-redelivery risk in the channel guide. Document runHttpConnectionRequest's response-completion and closure semantics for plugin-owned webhook listeners on the SDK infrastructure page.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
The 64-read admission budget is hard-coded and not configurable, so raising reverse-proxy connection limits cannot relieve saturation and can feed more requests into the rejection path. Advise reducing or buffering upstream concurrency instead, and state plainly that the budget is fixed.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Recording the overload-tradeoff acceptance requested by this review's Before merge items: As the author and the operator deploying this listener, I accept the fixed 64-read admission limit, the close-aware Scope note: I am the PR author, not an openclaw/openclaw maintainer — this records the author/operator acceptance and the documented tradeoff. Explicit maintainer acceptance for Nextcloud users is still requested per the review's Decision needed section. |
Merge recordSummary: The Nextcloud Talk webhook listener previously admitted an unbounded number of concurrent unauthenticated body reads, so any client that could reach the port could occupy pre-auth readers and sockets for up to five seconds each, delaying or blocking legitimate webhook deliveries. This PR acquires a listener-owned in-flight slot before the unauthenticated read, rejects overflow with an immediate close-aware HTTP 429, releases the slot after signature verification and before authenticated dispatch, and serializes each connection through the shared HTTP request lifecycle so an overflow rejection can never destroy a socket ahead of an earlier queued acknowledgement. The documented overload tradeoff — fixed 64-read limit and possible delivery loss during saturation with unverified sender redelivery — is accepted by the author/operator and recorded in the channel guide and PR discussion. Decision Reason for Merge: Merged because ClawSweeper's final review found no actionable defects and rated the patch correct (platinum hermit 4/6, ready for maintainer look), the real-TCP proof verified the fixed behavior, the author accepted the documented overload tradeoff, and the sole failing CI check was a timing-flaky core test unrelated to this PR's files — the same flake failing other PRs — with all other checks green. Compatibility Checks Done: Full extension suite (28 files, 195 tests) green locally; |
…#146356) * fix(nextcloud-talk): reject excess concurrent webhook reads Acquire a listener-owned in-flight limiter slot before the unauthenticated webhook body read, reject overflow with a close-aware HTTP 429, and release the slot after signature verification but before authenticated dispatch. Incomplete requests previously pinned a pre-auth reader for the full timeout without consuming the authentication-failure budget, letting any reachable client hold unbounded numbers of sockets and readers to degrade webhook availability. This follows the owner-level pattern merged for SMS (openclaw#136504) and Feishu (openclaw#137230). * fix(nextcloud-talk): preserve queued acknowledgements under pipelined overflow Serialize webhook admission per connection through the shared HTTP request lifecycle (runHttpConnectionRequest, re-exported on the plugin SDK guards subpath) so a pipelined request's overflow rejection only starts after every earlier response on the connection finished. Covers the reviewed sequence with real TCP: a saturated keep-alive connection with admission pending past the one-second close timer must still deliver the earlier signed 200 before the close-aware 429. * docs(nextcloud-talk): document overload admission and SDK connection ordering Record the 64-slot admission bound, its close-aware 429 overflow behavior, ordered keep-alive acknowledgements, and the unverified sender-redelivery risk in the channel guide. Document runHttpConnectionRequest's response-completion and closure semantics for plugin-owned webhook listeners on the SDK infrastructure page. * docs(nextcloud-talk): correct overload mitigation guidance The 64-read admission budget is hard-coded and not configurable, so raising reverse-proxy connection limits cannot relieve saturation and can feed more requests into the rejection path. Advise reducing or buffering upstream concurrency instead, and state plainly that the budget is fixed.
Summary
The Nextcloud Talk webhook admitted an unbounded number of concurrent unauthenticated body reads: every incomplete request pinned a pre-auth reader for up to five seconds without ever consuming the authentication-failure budget, so any client that could reach the listener could hold arbitrary numbers of sockets, request objects, and timers and delay or block legitimate webhook deliveries. This PR acquires a listener-owned in-flight slot before the unauthenticated read, rejects overflow with an immediate close-aware HTTP 429, releases the slot after signature verification and before authenticated dispatch, and serializes each connection's requests through the shared HTTP request lifecycle so an overflow rejection can never destroy a socket ahead of an earlier queued acknowledgement — the same owner-level admission pattern already merged for the SMS and Feishu webhooks.
What was wrong
extensions/nextcloud-talk/src/monitor.ts— the request handler awaited the full body read (64 KiB cap, 5 s timeout) with no aggregate admission bound. Only per-request limits existed, so concurrent incomplete requests multiplied without limit.extensions/nextcloud-talk/src/monitor.ts— the authentication-failure rate limiter records a failure only insideverifyWebhookSignature, which runs after the body read. Incomplete bodies therefore never consumed the abuse budget, and the per-client limiter could not bound the flood.extensions/nextcloud-talk/src/monitor.ts(introduced by the first two fixes in this PR, found in review) — a pipelined request on a keep-alive connection could reach the overflow rejection while an earlier signed delivery on the same connection was still waiting in durable admission. The rejection's close timer (1 s) then destroyed the socket while Node had the earlier200acknowledgement queued behind the429, losing that acknowledgement.Net effect: an unauthenticated remote client could exhaust pre-auth readers and sockets to degrade webhook availability (availability only — signature verification was never bypassed), and the naive bound would have traded that availability hole for lost acknowledgements on saturated keep-alive connections.
Why this design
Connection: closeinstead of pinning a reader for the full pre-auth timeout.runHttpConnectionRequest, now re-exported onopenclaw/plugin-sdk/webhook-request-guards): a pipelined request's admission — including any rejection — starts only after every earlier response on that connection has finished, so the close timer can never outlive a queued acknowledgement.Why this does not conflict with #136504 and #137230
Only shared code is
src/plugin-sdk/webhook-request-guards.ts(re-export added) andsrc/infra/http-request-lifecycle.ts(consumed, not modified). Both PRs are contained in this branch's base.Evidence
HTTP/1.1 429withConnection: closeacknowledgedAt = -1)Sink-level observations come from raw-socket runs against the production
createNextcloudTalkWebhookServerlistener before and after the change; the pipelined-acknowledgement regression test fails on the pre-ordering head (expected -1 to be greater than or equal to 0) and passes on this head.Overload and delivery decisions
The operator accepts bounded overload refusal and documents it: the channel guide now records the 64-slot admission bound, the close-aware
429overflow behavior, ordered keep-alive acknowledgements, and the explicit caveat that the budget is fixed and not configurable — deployments that regularly saturate it should reduce or buffer upstream concurrency (for example, cap reverse-proxy fan-in toward the listener) and accept that deliveries refused during saturation may be lost.429+Connection: closeretained — the semantically correct per-listener admission signal, matching the merged SMS and Feishu precedent;503(proposed by fix(nextcloud-talk): bound concurrent pre-auth webhook reads #138278) implies service-level unavailability rather than a per-listener budget. If maintainers prefer503, the switch is a one-line change in the rejection call.runHttpConnectionRequest's response-completion and closure semantics are documented on the SDK infrastructure page (pass the response for ordering; omitting it releases the next request early and loses the guarantee).Testing
extensions/nextcloud-talk/src/monitor.preauth-inflight.test.ts— real-TCP regressions for (a) the 64-slot overflow rejection and recovery, and (b) preservation of an earlier queued acknowledgement when a pipelined request hits overflow with admission pending past the close timer; (b) fails on the pre-ordering head and passes on this head.extensions/nextcloud-talksuite — 28 test files, 195 tests, including the durable-acknowledgement and replay payload-validation suites.tsgo:extensions:test, type-aware oxlint and oxfmt on touched files,check:changed --base upstream/main(including the Plugin SDK surface budget), and the assertion-SAFETY ratchet againstupstream/main— all green.