Repository navigation
fix(feishu): reject excess concurrent webhook reads - #137230
Conversation
|
🦞👀 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: needs maintainer review before merge. Reviewed September 10, 2026, 8:19 PM ET / September 11, 2026, 00:19 UTC (Revision 5). ClawSweeper reviewWhat this changesThe Feishu plugin limits concurrent unauthenticated webhook body reads to 64 per account route, closes excess requests with HTTP 429, and releases capacity before event dispatch. Merge readiness✅ Ready for maintainer review This remains a useful, bounded fix absent from current main and the latest release. The earlier slot-release finding is resolved, the recorded transport proof is sufficient, and the assigned reviewer explicitly accepted the overload tradeoff. No blocking correctness findings remain. Priority: P2 Review scores
Verification
How this fits togetherFeishu’s webhook transport receives HTTP callbacks, reads their bodies, and verifies signatures before forwarding events to the plugin’s inbound dispatcher. This change bounds the unauthenticated reading stage. flowchart TD
A[Feishu HTTP callback] --> B[Route and request checks]
B --> C{Read capacity available?}
C -->|No| D[HTTP 429 and connection close]
C -->|Yes| E[Bounded body read and signature check]
E --> F[Release read capacity]
F --> G{Valid signed payload?}
G -->|Yes| H[Event dispatch and response]
G -->|No| D
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +32, Tests +236. Total +268 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Retain the existing shared limiter and rejection lifecycle at Feishu’s pre-authentication boundary, with the explicitly accepted overload behavior and unchanged authenticated dispatch. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: concurrent incomplete POST bodies enter independent readers without an account-route cap on current main. Recorded before/after TCP evidence supports the repair; this read-only review did not execute tests. Is this the best way to solve the issue? Yes. The patch uses existing SDK primitives at the transport owner and releases capacity before downstream work; the meaningful overload tradeoff now has explicit reviewer acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b8e2dbc7ca42. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review Preparing this PR for maintainer landing at |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Patrick-Erichsen
left a comment
There was a problem hiding this comment.
Approved for landing once integrated-head CI passes at c98ed1040e28bf33c7a7efbe6533daaa2cf5083c. The signed merge retains contributor ancestry and both the route-local pre-auth limiter and current-main signed-timestamp checks. Independent review of the resolved two-file delta and fresh autoreview found no actionable defects. Existing real-TCP RED/GREEN, recovery and stalled-dispatch controls are retained; the new CI run must validate their integration: https://github.com/openclaw/openclaw/actions/runs/34545481411 . A fresh local Testbox request stopped before allocation because Blacksmith was signed out, so no additional remote execution is claimed. The intended 64-reader bound and overload 429 tradeoff are accepted in this scoped fix.
|
Merged via squash.
|
* fix(feishu): bound pre-auth webhook reads * fix(feishu): release pre-auth slots before dispatch
* 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 (#136504) and Feishu (#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.
…#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.
What Problem This Solves
Fixes an issue where Feishu webhook operators could lose inbound availability when many clients held request bodies incomplete before signature validation. Every request could occupy a raw-body reader until timeout, with no route-level concurrency bound.
Why This Change Was Made
The Feishu webhook owner now admits at most 64 concurrent pre-authentication body reads per account route. It reuses OpenClaw's shared webhook in-flight limiter and closed HTTP rejection lifecycle, so overflow receives HTTP 429 with
Connection: close; every admitted slot is released after raw-body handling and signature validation, before authenticated parsing and event dispatch.This follows the accepted owner-level pattern from merged SMS PR #136504. It does not change Feishu's existing per-client request-rate limit or post-authentication dispatch behavior.
User Impact
Feishu webhook handling remains available when incomplete uploads consume the pre-authentication read stage. Up to 64 reads may proceed for one account route; excess requests are closed with 429, and capacity returns when admitted requests finish or disconnect.
Evidence
Exact-head proof receipt
f00aebcbada845d45d60f52e954666c647bd1dd56c446343df30e7e831281327ddf403ebc5a82691requestlistener created bymonitorWebhook()inextensions/feishu/src/monitor.transport.ts.readWebhookBodyOrReject()andisFeishuWebhookSignatureValid().Acceptance red, same test and transport with only the production change removed:
Acceptance green at the exact head:
The overflow assertion requires the 429 response in less than 400ms. Held requests use a 5-second body timeout only in this scenario, so a timeout cannot masquerade as successful overflow admission.
Release-scope acceptance red, using the same real HTTP listener and request sequence with the slot held through dispatch:
Release-scope acceptance green at the exact head:
This control proves authenticated downstream latency cannot consume the bounded pre-authentication read capacity. Timeout, body rejection, guard-trip, invalid-signature, and signature-exception paths all release through the same owner-scoped
finally.Focused verification:
node scripts/check-changed.mjs --base upstream/main -- <two changed files>classified the intendedextensionsandextensionTestslanes, but this host's Corepack shim could not load its missing cached[email protected]. The equivalent focused test, direct formatter, direct linter, andgit diff --checkpass; exact-head GitHub CI remains the full-tree gate.Scope and impact
+59/-27(net+32)+238/-1createWebhookInFlightLimiterandsendHttpRequestRejectionfrom the public plugin SDK; no dependency, custom queue, or alternate HTTP lifecycle was added.openclaw.jsonor environment setting.Maintainer integration verification (2026-09-10)
Integrated current main
48b319e240fa5e8024b88efabe9f1de492939238with a signed merge atc98ed1040e28bf33c7a7efbe6533daaa2cf5083c, preserving contributor ancestry. Resolved the two adjacent constant/import conflicts while retaining both the pre-authentication concurrency bound and main’s signed-timestamp freshness validation and rejection tests. The resulting diff against that main remains limited to the two intended Feishu files.Independent source verification and fresh autoreview found no actionable defects. The existing real-TCP RED/GREEN, capacity recovery and stalled-dispatch evidence above remains the behavior baseline. A fresh Blacksmith Testbox attempt stopped before allocation because the local CLI was unauthenticated; no new remote test execution is claimed. Exact integrated-head CI is running here and must pass before landing.
The transport-owned limit intentionally returns 429 to any excess request, including legitimate bursts, until capacity returns. It does not alter signature validation or authenticated dispatch semantics.
Fresh integrated-head CI passed: run 34545481411, including 2,053 tests in 102 Feishu files. The hosted logs confirm excess-read rejection/recovery, capacity release before signed dispatch, and both stale/future signed timestamp rejection all passed together.