Title: fix(webhooks): accept the methods and expose the request metadata the generic webhook advertises by waleedlatif1 · Pull Request #6893 · simstudioai/sim · GitHub
Open Graph Title: fix(webhooks): accept the methods and expose the request metadata the generic webhook advertises by waleedlatif1 · Pull Request #6893 · simstudioai/sim
X Title: fix(webhooks): accept the methods and expose the request metadata the generic webhook advertises by waleedlatif1 · Pull Request #6893 · simstudioai/sim
Description: Supersedes #6889, whose four commits this branch contains unchanged and unsquashed — the feature is @minijeong-log's work and their authorship is preserved in git history. Please credit that PR when merging. Fixes #6888. The bug Open a Webhook Trigger today and the Setup Instructions make three claims. All three are false: The panel says What happens "will receive any HTTP method (GET, POST, PUT, DELETE, etc.)" Only POST. Everything else gets 405. "All request data (headers, body, query parameters) will be available" Only the body. formatInput is return { input: body } — headers and query parameters are read off the request and discarded. "include the token using either the custom header or Authorization: Bearer" Not either. Set a Secret Header Name and verifyTokenAuth returns early; Bearer never works. So a service calling .../trigger/abc?orderId=123 with X-Event-Name: created reaches a workflow that can see neither value, and no way exists to get them. You reference query.orderId because the panel said the data was there, get nothing, and have no indication why. What this does Makes the panel true, as an opt-in. query is exposed unconditionally — it is dropped today, it only appears when the caller's own URL carries parameters, and a body field of the same name still wins. That is the reported bug and it needs no toggle. Everything else is a per-webhook flag, off by default: Switch providerConfig flag Effect Accept Other HTTP Methods acceptOtherMethods Accept GET, PUT, PATCH, DELETE; expose method Expose Request Headers exposeRequestHeaders Expose headers, minus credential-bearing ones extraDeliveryMethods declares the methods and the flag that unlocks them, so acceptsWebhookDeliveryMethod requires both. A provider-level capability alone would have changed behavior for every generic webhook already deployed — accepting GET on URLs that answered 405 yesterday, and writing every inbound header into execution logs on POST deliveries that never asked for it. method rides the methods flag rather than getting its own: until a webhook accepts more than POST it is the constant "POST", so emitting it would change every existing payload to say nothing. Trigger outputs are condition-gated on their switches, so the reference dropdown cannot offer a field the running webhook will not send. Two cross-provider bugs fixed along the way Challenge handlers run before the webhook lookup and match on payload shape alone, so one that answers on a method its provider never uses will intercept a delivery addressed to whoever owns the path. Today a GET ?validationToken=abc to any webhook path echoes abc back with a 200. handleProviderChallenges now gates every handler to POST by default via challengeMethods. WhatsApp widens it to GET — Meta sends the verification handshake that way — so the one real exception is stated in the type rather than implied by the absence of a guard. Separately, WhatsApp answered 403 for hub.* parameters on a path with no WhatsApp webhook expecting a token. Those parameters belong to whoever owns the path; it now falls through. Security The credential-header denylist covers 24 names (authorization, apikey, x-functions-key, x-access-token, x-amz-security-token, x-goog-api-key, …). Because a denylist is leaky by construction it is not the only defense: the webhook's own token is withheld by value as well as by name, catching a sender that repeats it under a header nobody anticipated. Value matching applies only above 8 characters so a short token cannot strip unrelated headers. And the whole feature is off unless the owner turns it on. Note that authentication is header-based, so it cannot be used with a plain link — the "trigger from a URL in an email" case requires disabling auth. The instructions now say so outright instead of leaving users to discover it after publishing an open trigger URL. Compatibility No migration. The gate is the absence of a database key: every generic webhook written before this exists has neither flag, undefined reads as off, and the old behavior is what the new code produces when it finds nothing. POST responses: unchanged (acceptsWebhookDeliveryMethod returns true for POST before reading anything). POST workflow input: body + query. method and headers are absent without flags. PUT/PATCH/DELETE: previously unrouted, so Next returned 405; without the flag they return 405. GET: verified branch by branch against staging — unknown path, un-flagged generic webhook, POST-only provider, non-path trigger and pending setup verification all answer exactly as they do today. Queued jobs: payload.query/method are optional and defaulted on read, and the payload has no runtime schema, so a new payload on an old worker during a rolling deploy is inert. Three things do change, all intentional, two of them the bug fixes: query appears when the caller's URL has parameters. GET ?validationToken=abc stops echoing (Graph sends validation as POST; unaffected). WhatsApp hub.* on a path with no WhatsApp webhook returns 405 instead of 403. Also PUT/PATCH/DELETE get their own contracts instead of reusing webhookTriggerPostContract, whose method: 'POST' had become untrue. A GET delivery generated two different request IDs and parsed and challenged twice; one entry point now does each once. Every non-POST rejection answers the same 405 with Allow: POST, whether the path is unknown, holds only non-path triggers, or holds a trigger that has not opted in — so a probe cannot tell them apart. Object.hasOwn replaces key in body, so an inherited property name no longer reads as a collision and swallows the metadata. Flags read through isProviderConfigFlagEnabled, which treats only true/'true' as on: the editor writes booleans, but a YAML- or Copilot-authored workflow can write the string 'false', which is truthy and would ship the inverse of the setting the user sees. The metadata-drop logs are debug, not warn — each fires once per delivery for a webhook whose shape simply is that way. Testing vitest run lib/webhooks triggers app/api/webhooks → 823 passed / 66 files. Full apps/sim suite → 28,616 passed, one unrelated pre-existing flake (lib/auth/sso-trust.test.ts, a 10s import timeout that fails at a similar rate on staging — 1 in 4 there, 1 in 3 here). bun run type-check clean, bun run check:audits 32/32, real next build completes. Every guard was mutation-tested — reverted individually, confirmed red, restored: Guard broken Tests that fail Per-webhook opt-in flag ignored 2 Header exposure gate removed 4 Method exposure gate removed 30 Challenge method gate removed 5 Token value-withholding removed 2 Boolean(value) flag coercion 1 404/405 uniformity removed 1 Pre-lookup handshake order inverted 2 That last row exists because an earlier revision of this branch did invert it, and it passed all 820 tests at the time — nothing asserted where the challenge offer sat relative to the load-shed gate or the verification probe. Cursor Bugbot caught the half I had missed: behind tryAdmit, a busy instance answers 429 to Meta's WhatsApp handshake and the webhook silently fails to verify at setup time. Not verified: nobody has sent a real HTTP request at a running instance on this branch. Worth a manual pass before this reaches production.
Open Graph Description: Supersedes #6889, whose four commits this branch contains unchanged and unsquashed — the feature is @minijeong-log's work and their authorship is preserved in git history. Please credit that PR...
X Description: Supersedes #6889, whose four commits this branch contains unchanged and unsquashed — the feature is @minijeong-log's work and their authorship is preserved in git history. Please credit tha...
Opengraph URL: https://github.com/simstudioai/sim/pull/6893
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:7ba98340-221e-c752-8276-4f318055da5b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9CCC:24084C:2842:3531:6AFB63E8 |
| html-safe-nonce | bc4045e23ccefa8a7953fe65d95d681af76a2b52e514336cbdbaa1ba496b99c8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0NDOjI0MDg0QzoyODQyOjM1MzE6NkFGQjYzRTgiLCJ2aXNpdG9yX2lkIjoiODY2MTcxNzQwODcxMDA5MTc1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8940c7a196b793bd408cc84d258da47452d8180d60c10e841b605fe6d3bf56ea |
| hovercard-subject-tag | pull_request:4325442271 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6893/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Supersedes #6889, whose four commits this branch contains unchanged and unsquashed — the feature is @minijeong-log's work and their authorship is preserved in git history. Please credit that PR... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width