From e3294e5351e0b728be242522e78ae7f564b31814 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 17 Dec 2024 14:58:40 -0600 Subject: [PATCH] pipeline: block events too far in the future --- src/pipeline.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pipeline.ts b/src/pipeline.ts index ab303709..5becff20 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -31,8 +31,7 @@ const console = new Stickynotes('ditto:pipeline'); * It is idempotent, so it can be called multiple times for the same event. */ async function handleEvent(event: DittoEvent, signal: AbortSignal): Promise { - // Integer max value for Postgres. TODO: switch to a bigint in 2038. - if (event.created_at >= 2_147_483_647) { + if (eventAge(event) < -Time.minutes(1)) { throw new RelayError('invalid', 'event too far in the future'); } // Integer max value for Postgres.