Conversation
PR dummy environments
Sync prod and dev
…check Railway gates deploys by probing $PORT/health, and the Slack Bolt receiver is the server bound to $PORT (3004). The /health endpoint only existed on the separate webhook server (WEBHOOK_API_PORT, 3003), which Railway never probes, so the healthcheck 404'd and dev deploys failed (replicas never became healthy). Add a /health custom route to the Bolt HTTPReceiver so the probe on $PORT returns 200 and deploys can complete. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
fix(consumers): serve /health on the Bolt receiver for Railway healthcheck
…creation Adds a nullable, encrypted `secret` column to `users`, generated server-side via crypto.randomBytes and encrypted with the existing CryptoUtil/ TOKEN_ENCRYPTION_KEY (same as workspace bot tokens) whenever a brand-new channel: 'webhook' user is created through the subscription flow. The plaintext secret is returned exactly once, only in the POST /subscriptions/:dao response for that first-creation call, and is never accepted as caller input or overwritten on existing rows.
…eport webhook secret onConflict(...).merge() on users.create() merged ALL insert columns on conflict, and Postgres ON CONFLICT DO UPDATE never raises a unique-violation error - so two concurrent first-time inserts for the same new webhook user could silently clobber each other's secret, and both callers would return their own (possibly stale) plaintext secret. Restrict the merge to the conflict key columns only (channel, channel_user_id), so a racing insert can never touch secret/token. In handleSubscription, compare the row Postgres actually persisted against what this call tried to insert; only return the locally generated plaintext secret when they match, otherwise this call lost the race and must behave like the "already existed" path.
POST /webhooks now returns the secret from subscription-server exactly once, on first registration, threaded through SubscriptionAPIService and WebhookService.registerWebhook.
Extend findByIdsWithWorkspaceTokens to decrypt the webhook `secret` column onto the same user.token field the Slack/Telegram bot-token lane uses, so the dispatcher forwards it as payload.bot_token with no dispatcher changes. WebhookService.sendNotification now HMAC-signs each POST body with that token (X-Webhook-Timestamp/X-Webhook-Signature headers) and skips delivery (logged) when no token/secret is present, so no unsigned webhook delivery can go out.
Wire up @fastify/swagger + @fastify/swagger-ui on WebhookServer, mirroring subscription-server's setup, and complete the Zod route schemas (tags, descriptions, response shapes) so GET /docs/json and GET /docs document the existing HMAC secret issuance and delivery verification recipe. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Documents webhook registration/unregistration and the HMAC-SHA256 delivery verification steps in plain prose, mirroring the OpenAPI descriptions added in Task 4, so subscribers don't need to load Swagger UI. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…secret decrypt failure Final branch review flagged the secret-decrypt error log as a copy-pasted "failed to decrypt workspace token" message, misleading in ops logs. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Existing webhook users created before the secret migration had null secrets and could not receive notifications after signed delivery was enforced. When handleSubscription finds an existing webhook user without a secret, generate and persist one via updateSecret and return the plaintext once.
Webhook secret
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
LeonardoVieira1630
self-requested a review
July 17, 2026 13:10
LeonardoVieira1630
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
High Risk
Touches secret generation, encryption-at-rest, HMAC signing, and subscriber credential flow—security-sensitive changes plus a DB migration that must run before deploy.
Overview
Adds HTTP webhook subscriptions with cryptographic verification: subscribers register an HTTPS URL, receive a one-time signing secret on first registration, and get notification POSTs signed with HMAC-SHA256 (
X-Webhook-Timestamp,X-Webhook-Signature-V2over{timestamp}.{rawBody}). Deliveries are skipped when no secret is available.The subscription-server persists an encrypted
users.secret(new migration), generates secrets only for thewebhookchannel, exposes optionalsecreton subscribe responses, and decrypts webhook secrets into subscriber tokens when fan-out loads users. User insert conflicts no longer overwrite existingsecret/token columns.The consumers webhook API returns the secret on first
POST /webhooks, documents verification in OpenAPI/Swagger at/docs, and README covers receiver verification. Railway PR deploys for several apps are set to NOOP; Slack Bolt adds a/healthroute for checks.Reviewed by Cursor Bugbot for commit 1944814. Configure here.