At 2:00 p.m., a security engineer replaces the secret used to sign outbound webhooks. The sender starts using the new value immediately. One customer updates its receiver at 2:04. For four minutes, every legitimate event fails verification.
Nothing is wrong with the signature algorithm. The product changed both sides of a trust relationship as though they were one setting.
A webhook secret is shared state. Rotation is therefore a coordinated product workflow, not a text-field edit followed by a save button.
Separate routine rotation from compromise
Products usually need two rotation policies because the acceptable transition changes with the reason.
Routine rotation is planned maintenance. The old secret can remain valid for a short, declared overlap while receivers adopt the replacement. Operators can schedule the change, notify integration owners, and measure progress before revocation.
Suspected compromise is different. Continued acceptance of the old secret may extend an attacker’s access. The product may need immediate revocation, a much shorter overlap, or a selective pause in delivery. It should state that tradeoff plainly instead of presenting one cheerful Rotate button for every situation.
Ask for the rotation reason and show the resulting policy before confirmation. Include the planned activation time, overlap length, old-secret revocation time, affected endpoints, and expected delivery behavior. A user responding to an incident should not have to infer whether the old credential will work for another hour.
HMAC remains a sound verification mechanism when it is implemented correctly. GitHub’s guidance calls for a high-entropy secret, an HMAC-SHA256 digest of the unchanged request body, and a constant-time comparison. RFC 2104 also recommends periodic key refresh to limit damage from exposed keys. Neither source turns replacement into an instantaneous distributed update.
Support an explicit overlap state
The receiver needs time to accept two valid signatures while the sender moves from one secret to the next. Model that period as a visible state.
A practical sequence has four stages:
- Created: the replacement exists, but the sender still signs with the current secret.
- Ready: authorized operators can retrieve or inject the replacement into the receiver.
- Overlapping: the sender signs with the replacement while the receiver accepts both values.
- Revoked: the old secret no longer validates new deliveries.
The sender may include a non-sensitive key identifier with each signature so a receiver can select the right verification key and record which version succeeded. This identifier must not reveal the secret. Signature coverage still has to include the exact raw payload, and comparisons still need timing-safe behavior.
Do not keep overlap indefinite. Display an expiration time and require a deliberate extension with an audit reason. An unbounded compatibility period quietly converts a rotation into permanent acceptance of an old credential.
Multi-region and multi-worker receivers make the boundary harder. Some instances may load the new value while others retain a cached version. That creates signature split-brain: identical deliveries pass or fail according to which instance receives them. The product should surface verification results by secret version, endpoint, region, and deployment version so the pattern is visible.
Prove receiver readiness before revocation
An operator clicking “stored” is not evidence that production traffic can be verified.
Offer a signed challenge or test delivery using the replacement before activation. The receiver should return a result tied to the endpoint and key identifier. Record when the check ran, which signing version it used, and whether the request passed through the same ingress path as normal traffic.
Then observe real deliveries during overlap. A receiver that validates the test but rejects production payloads may hash a parsed body, apply the wrong encoding, or read a stale secret in one region. Readiness should require both a successful controlled check and a healthy sample of actual deliveries when traffic volume permits.
The product must also define what happens at the deadline. Safe choices include revoking as scheduled, delaying revocation within a bounded grace period, pausing affected subscriptions, or escalating to an owner. The right default depends on the rotation reason and the business cost of dropped events.
AWS Secrets Manager treats rotation as a staged workflow. Its documented process creates a new secret, applies it to the protected service, tests it, and then marks the version current. That order captures the important product idea: verify the replacement against the real dependency before declaring the transition complete.
This workflow complements delivery receipts and replay controls. A receipt explains what happened to an event. A rotation window prevents a predictable wave of authentication failures and makes the remaining failures diagnosable.
Issue a rotation receipt
Every completed or aborted rotation should leave a durable record. Include the actor, reason, affected subscriptions, old and new key identifiers, creation and activation times, overlap extensions, readiness evidence, revocation time, and delivery outcomes during the window.
Keep secret values out of the receipt. Access to reveal or export a secret should have its own narrow authorization, short display window, and audit event. Prefer delivery into a managed secret store when the customer’s environment supports it.
The receipt should answer whether the transition was safe, not merely whether an API call returned success. Report endpoints that never proved readiness, signatures rejected by version, deliveries held or replayed, and the final state of the old credential.
Measure rotations completed before deadline, overlap duration, failed verification rate by key version, emergency revocations, extensions, endpoints paused, and time from activation to confirmed readiness. Alert on use of the old secret near expiration. Alert again if any accepted request appears to use it after revocation.
Test the ugly paths. Rotate while deliveries are retrying. Let one region miss the configuration update. Roll back a receiver during overlap. Expire the old secret while an event is in flight. Attempt an emergency revocation with no reachable integration owner. Verify that the interface, audit record, alerts, and replay tools tell one consistent story.
Secret rotation should reduce exposure without creating a silent outage. Give both sides a bounded compatibility window, prove that the receiver is ready, revoke according to the stated risk policy, and preserve the evidence.
Sources
- Validating webhook deliveries, GitHub Docs.
- Rotate AWS Secrets Manager secrets, AWS Secrets Manager User Guide.
- RFC 2104: HMAC: Keyed-Hashing for Message Authentication, Internet Engineering Task Force.
Comments
Comments are powered by GitHub Discussions through Giscus.