Rotating Webhook Signing Secrets Without Losing Step Completions
A signing secret rotation that isn't staged correctly drops the very webhook events that complete onboarding steps. Here is how to rotate without a gap.
An onboarding step that completes from a webhook — a payment confirmation, an identity verification callback, a third-party import finishing — depends on verifying that webhook's signature before trusting its payload. That verification is exactly where a routine secret rotation goes wrong: flip the signing secret in one place without a transition window, and every in-flight event signed with the old secret fails verification and gets dropped, silently stalling whatever step it was supposed to complete.
Why rotation breaks completions specifically
Most webhook senders do not switch secrets atomically on their side. There is a window — sometimes seconds, sometimes the better part of a day — where events in flight, already queued for retry, or generated by a slow upstream process are still signed with the secret you are about to retire. If your verification only recognizes the current secret, every one of those events fails signature checks and gets rejected outright.
For most endpoints that is a nuisance: the sender retries, the retry arrives after rotation settles, it eventually succeeds. For an onboarding step, it is worse: the user is staring at a checklist item that looks stuck, because the one event that would have flipped it to done was the one your endpoint just rejected as invalid.
Verify against both secrets during the window
The fix is not clever: keep the old secret valid for verification alongside the new one for a defined overlap period, and only remove it once you are confident every sender has caught up. The signing secret itself is just a credential your code checks against — there is nothing stopping it from being a short list instead of a single value during rotation.
// pseudocode: verify against current and previous secret
function isValidSignature(payload, signature, secrets) {
return secrets.some(secret => computeHmac(payload, secret) === signature)
}
// rotation: secrets = [newSecret, oldSecret] during the overlap window
// after the window: secrets = [newSecret]
This only works if you know roughly how long events can stay in flight on the sender's side — check the provider's documented retry window, and set the overlap at least that long, not an arbitrary guess.
Give the step a way to resolve late
Even with an overlap window, something will arrive late: a sender's own outage, a queued retry that waited longer than expected. The step that depends on this webhook needs to tolerate a completion event arriving well after the user last looked at the checklist, rather than treating "no event yet" as a reason to mark the step failed. See the docs for how step records carry a pending state separate from failed.
If an event never arrives at all — genuinely lost, not just late — that is a different problem: a reconciliation job that polls the sender's API for the true state of whatever the webhook was supposed to report, run on a schedule, catches the cases a dropped signature check created. Without that job, a rotation mistake becomes a permanent stuck step for whichever users happened to be mid-flow when you rotated.
Rotate the secret, not the endpoint
A related mistake is treating rotation as an excuse to also change the webhook URL or move the handler, on the theory that you are already touching the configuration. Do one thing at a time: changing the endpoint at the same moment as the secret means a failure could be either problem, and you lose the ability to tell signature-rejection apart from routing failure while diagnosing a stalled step.
What to measure instead of guessing
We do not have a measured number for how many webhook events arrive after a typical rotation's overlap window closes. That is worth instrumenting directly: log every signature verification failure with which secret(s) were tried and the event's apparent age, and watch that count spike (or not) around your next rotation. If it spikes, the overlap window was too short; if it stays flat, you can safely shorten it next time.
Related reading
For the retry behavior on the sending side of the same problem, retrying failed onboarding webhook deliveries covers what a sender does when your endpoint rejects an event. For steps that complete from a background process rather than a webhook, marking a step done from an async background job covers the same completion-timing problem from the worker side. Try the live preview to see how step states render today.