Valid signature, old timestamp: should n8n process this CRM webhook?

Your CRM retries a webhook after n8n has been unavailable. The signature is valid, but the timestamp inside the signed body is hours old. Should you reject it?

Check the sender’s retry policy first. In my Perfex–n8n bridge, retries keep the original signed body. With the default five-retry schedule, the delays add up to 17h20m. The verifier accepts an 18-hour window. If you increase the retry count, you also need to revisit that window; the default margin no longer covers the full schedule.

The source, n8n blueprint and test harness are here:
marchikx/perfex-n8n-bridge-platinum⁠

From the repository root, run:

node tests/verify-node.test.js

The harness runs the verifier code extracted from the blueprint with simulated inputs. It checks signature handling, acceptance at retry-age thresholds and repeated requests. It does not test the PHP queue or a deployed n8n workflow end to end.

Two details matter before borrowing this pattern.

The repeat key is the HMAC: a fingerprint of the signed bytes, not an event ID. An unchanged retry produces the same signature, but so can two separate events with identical bodies. A regenerated body produces a different signature even when it represents the same event. For event-level deduplication, give each event a stable ID and preserve it across retries.

This blueprint also stores accepted signatures in workflow static data. That data is persisted after successful production executions, so it can flag later sequential repeats. It cannot reserve an event atomically: two overlapping runs can both pass the check, and a failed run may not persist it. For order or invoice creation, use a durable atomic claim tied to recoverable work, then protect the destination action separately.

Authentication, delivery deduplication and business-action idempotency answer different questions. A valid signature doesn’t settle the other two.

Does your CRM retry the original signed body, or generate a fresh one?

Right call matching the window to the retry schedule: the signed timestamp is a replay guard, not an ordering signal. Two things keep it safe. First, size the acceptance window to the sender’s full retry horizon — with five retries summing ~17h20m, anything under 18h silently drops legitimate retries. Second, store the sender’s event id (or a hash of the signed body) and drop a repeat inside the window, because a valid-but-old body is only a replay risk if you cannot tell first delivery from redelivery. If the CRM re-signs each retry with a fresh timestamp you can keep the window short; if it re-sends the original signed body (Perfex-style) the window must cover the whole schedule, which is what you hit. For the business decision, do not reject on staleness alone — apply last-write-wins on the payload’s updated_at so an hours-old retry cannot overwrite newer state, and only hard-reject outside the window once you have confirmed the sender cannot retry beyond it.

1 Like

Short answer: don’t reject it just for being old. An old timestamp with a valid signature is exactly what a legitimate retry looks like when the sender preserves the original signed body — rejecting it would turn your redelivery mechanism into a message dropper.

I’d split the check into three gates, in this order:

1. Signature validity (authentication) — is this really from the CRM? You’re doing this already. One n8n-specific note: the Webhook node doesn’t validate HMACs itself, so do it in a Code node with crypto and reject with a 401 before any business logic runs — and fail closed if the secret is missing.

2. Freshness window (replay protection) — accept only if the timestamp is within the sender’s max retry age plus a margin for clock skew. Your 18-hour window for a 17h20m retry schedule is exactly the right reasoning. But here’s the subtle trap: any window wide enough to accept legitimate retries is also wide enough for an attacker to replay a captured payload inside it. So the window alone isn’t security — it’s a bound that makes gate 3 practical.

3. Seen-before check (delivery dedup) — within the window, an unchanged retry and a malicious replay are indistinguishable: same bytes, same valid signature. This is why you need a dedup store keyed on a stable identifier. You’re right that HMAC-as-key breaks when the body is regenerated, and right about static data’s limits (no atomic reservation, two overlapping runs can both pass the check). In n8n I’d put this in a real store instead: a Postgres/Redis INSERT ... ON CONFLICT DO NOTHING keyed on the event ID or the signature, so the claim is atomic across concurrent executions. A unique-constraint insert can’t double-claim; static data can.

And then, separately from all of that: business-action idempotency. The three layers answer different questions, as you said — “was this delivery seen before?” is not the same as “was this business event already applied?” For anything like order/invoice creation, drive the guard from a stable event ID persisted at the destination (a DB unique constraint, or the CRM’s own idempotency key), not from webhook delivery state.

One operational habit that matters here: respond 200 from the workflow quickly and do the heavy processing after the ack (Respond to Webhook node, or hand off to a sub-workflow), so the sender’s retry timer doesn’t fire while you’re still working — otherwise you manufacture the very retries you’re defending against.

To your closing question: it matters because it decides your dedup key. Original bytes on retry → the signature works as a delivery key within the window. Fresh body per retry → you must carry a stable event ID through the retry, or retries and duplicates become indistinguishable from brand-new events. Worth confirming with a test retry before committing to either design.

On the quick 200, I’d make one boundary explicit: the receiver has to save enough information to recover the work without another delivery from the CRM.

For a durable intake layer here, I’d commit the event key, saved input and a pending job row together, then acknowledge. If dispatch uses a separate queue, commit an outbox record in that same transaction and dispatch from it. A claim row alone doesn’t preserve the work. Calling a sub-workflow doesn’t, by itself, demonstrate a recoverable handoff either.

The crash test I’d add is: let the CRM receive the 200, kill the receiver before a worker starts, then send nothing else. After restart, the saved work should still be discoverable and either processed safely or explicitly held with an operator alert. If a downstream write has an uncertain outcome, reconcile it before repeating it unless the destination’s documented idempotency guarantees make that retry safe.

One n8n detail is easy to miss: finishing without reaching Respond to Webhook can return a default 200. I’d test failed storage and an unexpected zero-item result too, so neither silently becomes a successful acknowledgement. A transient intake failure should produce an explicit failure response that the CRM’s retry policy handles.

@Marchik Your durable-intake boundary makes this a long-running job problem. Once the CRM receives 200, the receiver owns the unfinished work, including recovery that may happen in another execution or require a person.

One detail I’d add is distinguishing an abandoned claim from a slow worker. A timeout alone does not prove the original execution stopped. If a recovery worker takes over, I’d use a claim version or ownership token and reject stale updates. The external write still needs its own idempotency or reconciliation strategy.

For jobs held for review, I’d record an owner, the unresolved outcome, the provider reference, and the resolution decision. Otherwise the event can be safely stored but remain unfinished indefinitely.

I’d also qualify the Superseded rule: an older snapshot may be safely ignored, while an incremental event may still need applying.

Does your recovery path currently track who owns an unresolved job and prevent an older worker from updating it after takeover?

@bingqian99lee Not in the published bridge blueprint. It keeps accepted signatures in workflow static data; it doesn’t implement durable job ownership or a fenced takeover. My previous reply describes the intake layer I’d add, rather than a recovery guarantee that example already provides.

For the takeover case, I’d give each job a claim generation that increases atomically when ownership changes. Completion, heartbeat and retry-state writes must check that generation in the database update itself. Reading it first and then doing an unconditional update leaves the race open. For example, with an illustrative jobs table:

UPDATE jobs
SET status = 'completed'
WHERE id = $1
  AND claim_generation = $2
  AND status = 'in_progress'
RETURNING id;

$2 is the generation the worker received when it claimed the job. If no row is returned, it must stop that state transition and re-check ownership. It must not fall back to an unconditional update.

The test I’d use is to pause worker A, let its lease expire, have B acquire the next generation, then resume A. A must not renew the lease or mark the job completed. Separately, test A resuming around an external request: a database guard cannot retract a request already sent to the provider. That boundary still needs destination idempotency or reconciliation before another write.

I’d keep the human review owner separate from the worker lease, with the unresolved outcome, provider reference, next review time and recorded decision. That makes a held invoice or order someone’s task rather than an indefinitely pending row.

Agreed on snapshots versus increments: an older full snapshot may be superseded if the source’s version semantics support that. An incremental event needs its own application history; being older alone isn’t a reason to discard it.

rejecting webhooks with expired timestamps is a critical security practice to prevent replay attacks and duplicate state mutations in downstream crms. even with a cryptographically valid signature, stale payloads can overwrite newer customer records.

enforcing a strict five minute freshness window at your ingest node ensures only legitimate, real-time events trigger automation scenarios.

@Long_Vu_Nguyen I agree that replay protection matters. The five-minute rule depends on what the timestamp represents.

Stripe is a useful example⁠: its libraries default to five minutes, but Stripe generates a new signed timestamp for each retry. An old event can therefore arrive with a fresh delivery signature.

In this bridge, queued retries reuse the original timestamp inside the signed body⁠. After a one-hour outage, a five-minute cutoff would reject that delivery even if n8n had never received it.

Your point about overwriting newer CRM data still applies: a fresh signature does not make an older snapshot current. Duplicate deliveries need durable deduplication, and snapshot updates need a source-version check or reconciliation before replacing newer state.

For a revised design, I’d use a fresh signed delivery timestamp and preserve a stable event ID across retries. That needs matching sender and receiver support; it is not implemented in the published example.

I’d test both cases separately: a first delivery delayed by an hour, and a freshly signed delivery containing an older snapshot. The first tests delivery recovery; the second tests whether the CRM can be rolled back. A five-minute check alone doesn’t cover both.

Good distinction between delivery freshness and source-data freshness. I’d also test the failure window where a webhook is accepted and persisted, but the downstream CRM request times out with an unknown outcome. Retrying safely then requires provider-side idempotency or reconciliation, not just webhook deduplication.

I work with n8n, Python, APIs, and PostgreSQL, focusing on idempotency, concurrent processing, and explicit failure handling. I’m exploring practical automation and backend projects, and would be interested in helping test or implement similar reliability patterns if there’s a need for support.