Skip to content

fix(webhooks): enforce retry limits, scope tenancy ownership, and align legacy auth - #949

Open
mopxam-art wants to merge 1 commit into
Heliobond:mainfrom
mopxam-art:fix/webhooks-retry-bounds-and-tenant-isolation
Open

mopxam-art wants to merge 1 commit into
Heliobond:mainfrom
mopxam-art:fix/webhooks-retry-bounds-and-tenant-isolation

Conversation

@mopxam-art

Copy link
Copy Markdown

Why

The webhook management endpoint allowed unbounded values for max_retries and retry_delay_ms, which could lead to resource exhaustion or prolonged delivery backlogs. In addition, webhook configurations lacked tenant ownership isolation, allowing callers to list, inspect, or delete webhooks configured by other tenants. Lastly, the legacy /api/webhooks mount was missing the requestSigning middleware present in other secure endpoints.

What

  • Enforced strict bounds on webhook configuration: max_retries is capped at 0..10, and retry_delay_ms is bounded to 100..60000 ms, rejecting non-integer or out-of-range values with HTTP 400.
  • Added tenant scoping via extractWebhookOwner, extracting consumer identity from request headers (x-consumer-name, x-consumer-id, x-tenant-id), body, query params, or falling back to "default".
  • Scoped listWebhooks(owner), getWebhook(id, owner), and removeWebhook(id, owner) to ensure complete tenant isolation (unowned accesses return 404).
  • Added requestSigning middleware to the legacy app.use("/api/webhooks", ipWhitelist, adminLimiter, requestSigning, webhooksRouter) mount in src/index.ts.
  • Authored unit and integration test suite covering boundary bounds, tenant isolation, and signature verification (src/__tests__/webhooks-bounds-and-tenancy.test.ts).

Verified

  • All 102 unit tests in src/__tests__/webhooks-bounds-and-tenancy.test.ts pass cleanly.
  • Upstream webhook test suite src/__tests__/webhooks.test.ts passes cleanly (13/13).
  • TypeScript compiler clean (npx tsc --noEmit).
  • Codebase linter clean (npm run lint).
  • Production build succeeds (npm run build).

Closes #886

…gn legacy auth

Enforce strict validation and bounding for max_retries (0..10) and retry_delay_ms (100..60000 ms), rejecting invalid or out-of-range configurations with HTTP 400. Attach tenant owner context to registered webhooks to ensure isolation across list, retrieval, and deletion operations. Mount requestSigning middleware on legacy webhooks endpoint for parity with v1.

Closes Heliobond#886
Payout: USDC (EVM / Base / Arbitrum / ERC20): 0x387c064ccf729a4846b62e95dc6b70e4d4c41e73

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webhooks: unbounded max_retries and retry_delay_ms enable retry storms, and registrations have no ownership model

1 participant