Merge branch 'future-block' into 'main'

pipeline: block events too far in the future

See merge request soapbox-pub/ditto!607
This commit is contained in:
Alex Gleason 2024-12-17 21:07:18 +00:00
commit 75f9c90a8c

View file

@ -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<void> {
// 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.