Check event timestamps and replay handling

3 November 2026

A round stopwatch on a cord rests on a wooden surface.
Illustrative photograph. Cropped and resized. Photo by Anton Makarenko on Pexels. · Pexels License

Evaluating incoming PDF webhook events requires three validation gates: signature verification, timestamp freshness checking, and message idempotency lookup. A valid signature alone does not ensure freshness or protect against replay attacks. Under synthetic contract testing, a signed event arriving outside the agreed freshness window (such as 301 seconds drift against a 300-second window) is rejected as REJECTED_FRESHNESS. Conversely, a duplicate signed event arriving inside the freshness window is recognised as DUPLICATE based on its recorded event identifier, preventing redundant processing without triggering signature errors.

Evaluating timestamp freshness and message replay in PDF webhooks

Integrating webhook notifications for PDF processing requires separating signature authenticity, time freshness, and idempotency into distinct validation steps. Signature verification confirms payload integrity using a shared secret. However, re-transmitted valid requests will still pass signature verification.

To prevent replay attacks, the receiver compares the embedded timestamp against its local clock, discarding events outside the allowed freshness window. Events passing signature and timestamp checks undergo an idempotency lookup against recorded event identifiers. A timestamp policy limits the window in which replay is possible. It does not distinguish the first delivery from the tenth inside that window. Conversely, a known event ID does not make an out-of-window request fresh. Keep the results of the three checks separate in the receiver log. Event contract · Signed event results

Compare the two controls

The local Python 3.12.14 fixture used a synthetic reference clock of 1793448000, a 300-second window and a public test value. It verified HMAC-SHA256 over the timestamp, a dot and the exact UTF-8 body. The webhook server was not run and the exercise made zero network calls. These values belong to the local contract, not to a live provider. Event contract · Signed event results

The synthetic exercise evaluates two delivery scenarios:

  1. Stale signed event outside freshness window (old_signed_delivery): Event E02 for job SYN-J01 (revision 2, state SUCCEEDED) carries timestamp 1793447699 and signature 15a2f1d90b97e3a6b585c6b75de4e3c36734119c7e93ee8485295eac0572cdf1. Comparing reference clock (1793448000) and event timestamp (1793447699) reveals elapsed drift of 1793448000 - 1793447699 = 301 seconds. Exceeding the 300-second window by 1 second causes time verification to fail despite a valid signature, returning REJECTED_FRESHNESS. Future delivery (future_signed_delivery) with timestamp 1793448301 presents a 301-second future drift (1793448301 - 1793448000 = 301) and is likewise rejected as REJECTED_FRESHNESS.
  2. Duplicate signed event inside freshness window (duplicate): An identical body for event E02 (job SYN-J01, revision 2, state SUCCEEDED) arrives with timestamp 1793448000 (0 seconds drift) and signature f5cecb15d334b07b25f0bf4ee423985bdffdfaab12551dd6c1fa29f89bdbdc54. Following initial delivery (completion_first), which returned APPLIED, the duplicate event passes signature and timestamp checks but fails idempotency lookup, returning DUPLICATE.

Signed event results · Event contract

Worked decision record and evaluation ledger

The ledger below records evaluation outcomes across the local timing and replay cases using test fixture signed-event-results.json. Event contract · Signed event results

ScenarioEvent ID & StateTimestamp & DriftSignatureFreshness (≤300s)IdempotencyExpectedObservedAction Owner & Resolution
completion_firstE02 / SUCCEEDED1793448000 (0s)PassPassNew EventAPPLIEDAPPLIEDSystem: Revision 2 recorded.
duplicateE02 / SUCCEEDED1793448000 (0s)PassPassID RecordedDUPLICATEDUPLICATESystem: Acknowledged without reprocessing.
old_signed_deliveryE02 / SUCCEEDED1793447699 (301s past)PassFail (>300s)UnreachedREJECTED_FRESHNESSREJECTED_FRESHNESSSystem: Stale delivery rejected.
future_signed_deliveryE02 / SUCCEEDED1793448301 (301s future)PassFail (>300s)UnreachedREJECTED_FRESHNESSREJECTED_FRESHNESSSystem: Future drift rejected.
same_event_id_different_signed_bodyE02 / FAILED1793448000 (0s)PassPassConflictREJECTED_EVENT_ID_CONFLICTREJECTED_EVENT_ID_CONFLICTIntegration Lead: Audit upstream generator to prevent ID reuse.
live_endpoint_deliverySYN-J01 / PendingPendingPendingPendingPendingPENDINGNOT_RUNInfrastructure Team: Execute live HTTP test with TLS.

Signed event results · Event contract

The row for same_event_id_different_signed_body highlights a difficult result: event E02 carries a valid signature and timestamp but attempts to mutate job state from SUCCEEDED to FAILED, triggering REJECTED_EVENT_ID_CONFLICT. A nominated integration owner could investigate why the ID was reused; no actual assignment or upstream audit was recorded. Additionally, live_endpoint_delivery remains marked as NOT_RUN, so arrange an authorised endpoint test and record the actual owner and result. Signed event results · Event contract

Scope and limitations of local fixture evaluation

Local contract testing validates parser logic in isolation but does not equal production security validation. The first-party artefact signed-event-results.json documents explicit limitations: Event contract · Signed event results

  • No live HTTP endpoints, TLS handshakes, durable queues, provider redeliveries, or status APIs were exercised (network_calls: 0, webhook_server: NOT_RUN).
  • The evaluation is a bounded local contract test, not hardened production validation or a security audit.
  • Vendor protocol compatibility is explicitly NOT_CLAIMED.

Event contract · Signed event results

Matching a signature or timestamp check in a local fixture confirms parser logic under static inputs. It does not establish network transport security, clock synchronisation, or database permissions. Distinguishing local checksum matching from live access control prevents local passes from being misconstrued as production readiness.

Next step

Use the provider’s actual signature format, authorised source, tenant and documented freshness policy. On a harmless test job, compare a correctly signed old message with an exact duplicate received inside the accepted window. Check the response, persisted event identity and the number of downstream actions. Include cases exactly at each time boundary and document whether it is inclusive: the supplied ±301-second observations do not settle that question for another receiver. If the server and sender clocks disagree, record the measured skew and investigate before changing the acceptance window. Event contract · Signed event results

Part of the Test duplicate and out-of-order PDF webhook events guide.

Published by Arke Technologies (Pty) Ltd, Johannesburg. Drafted with NotebookLM. Source checks and editing by Kairos (Codex).