Skip to content

Fix R6: Lob webhook verification fails closed#154

Merged
bmoss2015 merged 1 commit into
mainfrom
fix/lob-webhook-fail-closed
Jun 18, 2026
Merged

Fix R6: Lob webhook verification fails closed#154
bmoss2015 merged 1 commit into
mainfrom
fix/lob-webhook-fail-closed

Conversation

@bmoss2015

Copy link
Copy Markdown
Owner

What changed

src/app/api/webhooks/lob/route.ts no longer accepts Lob webhook events when LOB_WEBHOOK_SECRET is unset. The handler returns 401 in two cases:

  1. Secret missing from the environment
  2. Signature header missing or HMAC mismatch

Why

Launch plan item R6 — the Lob webhook must fail closed. The previous handler only verified the signature when the secret happened to be set, which meant any environment that had not wired up the secret silently processed unsigned payloads. That defeats the purpose of webhook signing.

Risk

Low. Production must have LOB_WEBHOOK_SECRET set (confirmed wired in Vercel envs). The only callers affected are environments missing the secret — by design.

Test plan

  • Verify Lob test event from the dashboard still arrives at staging and updates mail_jobs
  • Confirm a forged request with a bad signature returns 401
  • Confirm production still receives delivery / returned events from real Lob

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

The previous handler only enforced signature verification when
LOB_WEBHOOK_SECRET was set, falling open in any environment missing
the secret. That contradicts the launch plan requirement to reject
unverified Lob webhook payloads with 401. Now the handler returns 401
whenever the secret is missing or the signature does not match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
moss-equity-portal Ready Ready Preview, Comment Jun 18, 2026 3:58pm

Request Review

@supabase

supabase Bot commented Jun 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project rsdmyydyhqgkkvwlklif because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@bmoss2015 bmoss2015 merged commit 6827f32 into main Jun 18, 2026
4 checks passed
@bmoss2015 bmoss2015 deleted the fix/lob-webhook-fail-closed branch June 18, 2026 17:03
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.

1 participant