Check event timestamps and replay handling
3 November 2026
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:
- Stale signed event outside freshness window (
old_signed_delivery): EventE02for jobSYN-J01(revision2, stateSUCCEEDED) carries timestamp1793447699and signature15a2f1d90b97e3a6b585c6b75de4e3c36734119c7e93ee8485295eac0572cdf1. Comparing reference clock (1793448000) and event timestamp (1793447699) reveals elapsed drift of1793448000 - 1793447699 = 301seconds. Exceeding the 300-second window by 1 second causes time verification to fail despite a valid signature, returningREJECTED_FRESHNESS. Future delivery (future_signed_delivery) with timestamp1793448301presents a 301-second future drift (1793448301 - 1793448000 = 301) and is likewise rejected asREJECTED_FRESHNESS. - Duplicate signed event inside freshness window (
duplicate): An identical body for eventE02(jobSYN-J01, revision2, stateSUCCEEDED) arrives with timestamp1793448000(0 seconds drift) and signaturef5cecb15d334b07b25f0bf4ee423985bdffdfaab12551dd6c1fa29f89bdbdc54. Following initial delivery (completion_first), which returnedAPPLIED, the duplicate event passes signature and timestamp checks but fails idempotency lookup, returningDUPLICATE.
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
| Scenario | Event ID & State | Timestamp & Drift | Signature | Freshness (≤300s) | Idempotency | Expected | Observed | Action Owner & Resolution |
|---|---|---|---|---|---|---|---|---|
completion_first | E02 / SUCCEEDED | 1793448000 (0s) | Pass | Pass | New Event | APPLIED | APPLIED | System: Revision 2 recorded. |
duplicate | E02 / SUCCEEDED | 1793448000 (0s) | Pass | Pass | ID Recorded | DUPLICATE | DUPLICATE | System: Acknowledged without reprocessing. |
old_signed_delivery | E02 / SUCCEEDED | 1793447699 (301s past) | Pass | Fail (>300s) | Unreached | REJECTED_FRESHNESS | REJECTED_FRESHNESS | System: Stale delivery rejected. |
future_signed_delivery | E02 / SUCCEEDED | 1793448301 (301s future) | Pass | Fail (>300s) | Unreached | REJECTED_FRESHNESS | REJECTED_FRESHNESS | System: Future drift rejected. |
same_event_id_different_signed_body | E02 / FAILED | 1793448000 (0s) | Pass | Pass | Conflict | REJECTED_EVENT_ID_CONFLICT | REJECTED_EVENT_ID_CONFLICT | Integration Lead: Audit upstream generator to prevent ID reuse. |
live_endpoint_delivery | SYN-J01 / Pending | Pending | Pending | Pending | Pending | PENDING | NOT_RUN | Infrastructure 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).
