<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw" -->

---
title: ActivityPub - Is it worth defending against replay...
description: An exploration of whether ActivityPub servers should defend against replay attacks and clock skew in message signatures. Timestamps in ActivityPub messages...
canonical: https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: ActivityPub - Is it worth defending against replay attacks and message/signature time skew? | daily.dev
og:description: An exploration of whether ActivityPub servers should defend against replay attacks and clock skew in message signatures. Timestamps in ActivityPub messages...
og:url: https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw
og:image: https://api.daily.dev/og/posts/FQ3LJ7mfw.png
og:image:alt: ActivityPub - Is it worth defending against replay attacks and message/signature time skew?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ActivityPub - Is it worth defending against replay attacks and message/signature time skew?

**[Terence Eden](https://daily.dev/sources/shkspr)** · 9 min read · 0 upvotes · 0 comments

## Summary

An exploration of whether ActivityPub servers should defend against replay attacks and clock skew in message signatures. Timestamps in ActivityPub messages (published/updated) can legitimately be old due to slow servers, retries, or lax standards compliance, and shouldn't be used to judge legitimacy. Instead, the HTTP signature's 'created' timestamp compared against the Date header is the relevant check, though standards like RFC 9421 don't specify an acceptable skew - implementations vary wildly, from Mastodon's one hour to Grishka's 30 seconds. The author argues that if you properly validate message hashes and signatures, and track unique message IDs to prevent reprocessing, timestamp/skew checking becomes largely unnecessary for preventing replay attacks, since replayed messages are mostly harmless due to idempotency, with edge cases around follow/unfollow and update sequences being the main risk, and those aren't fixed by timestamp checks anyway.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://shkspr.mobi/blog/2026/09/activitypub-is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew>

## Questions this post answers

### How much clock skew does Mastodon allow between the Date header and the signature creation time before rejecting an ActivityPub request?

Mastodon's source code suggests a window of about one hour between the Date header and the signature's created time. Other implementations vary significantly: Grishka's implementation allows only 30 seconds, while Evan Prodromou's code sets a maximum date difference of 5 minutes. The SWICG suggests roughly an hour plus a few minutes buffer to account for clock skew and timezone differences.

_Developers hardening federated server signature checks can track these implementation differences on daily.dev._

### Do I need to validate the published or updated timestamp in an ActivityPub message to detect fake or malicious messages?

No, checking the published or updated timestamp inside an ActivityPub message body is not necessary for validating legitimacy. Messages can legitimately arrive with timestamps that are minutes, days, or even months old due to slow server processing, retry delays, or servers reusing an original publish date instead of an updated one. Only obviously bogus dates, like ones far in the future or impossibly far in the past, might be worth flagging.

_daily.dev helps fediverse server maintainers compare real-world signature validation practices like this one._

### How do I prevent replay attacks in an ActivityPub server without relying on timestamp checks?

Prevent replay attacks by independently calculating the hash of the received message and validating it against the hash sent in the HTTP headers, then verifying the cryptographic signature covers that hash, and finally checking whether the message's unique ID has already been processed to enforce idempotency. If any check fails, the message should be ignored or rejected, making timestamp skew checks largely redundant for security.

_Teams designing federated protocol security can weigh trade-offs like these via daily.dev before shipping._

## Similar posts on daily.dev

- [A reasonably practical guide to validating RFC 9421 HTTP Signatures for ActivityPub in PHP](https://daily.dev/posts/a-reasonably-practical-guide-to-validating-rfc-9421-http-signatures-for-activitypub-in-php-jlxhqlzoq) · Terence Eden · 0 upvotes · 0 comments
- [Presigned URLs are technically a security vuln](https://daily.dev/posts/presigned-urls-are-technically-a-security-vuln-k55xo6puc) · Tigris · 56 upvotes · 1 comments
- [Why implementing ActivityPub is hard, and why it doesn't have to be](https://daily.dev/posts/why-implementing-activitypub-is-hard-and-why-it-doesn-t-have-to-be-uc9l3hqnb) · Lobsters · 0 upvotes · 1 comments
- [Time Without a Shared Clock: Rethinking Distributed Computing \#7](https://daily.dev/posts/time-without-a-shared-clock-rethinking-distributed-computing-7-dp1qjka8q) · Medium · 0 upvotes · 0 comments

---

Tags: [#cryptography](https://daily.dev/tags/cryptography), [#fediverse](https://daily.dev/tags/fediverse), [#activitypub](https://daily.dev/tags/activitypub)

[View this post on daily.dev](https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"ActivityPub - Is it worth defending against replay attacks and message/signature time skew?","url":"https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw"},"datePublished":"2026-09-08T11:38:23.258Z","dateModified":"2026-09-08T11:38:50.556Z","description":"An exploration of whether ActivityPub servers should defend against replay attacks and clock skew in message signatures. Timestamps in ActivityPub messages...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0188e2ed171dda59a3aa12b42fcb0e98?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/0188e2ed171dda59a3aa12b42fcb0e98?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Terence Eden","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Terence Eden","logo":"https://media.daily.dev/image/upload/s--nhylgPuf--/f_auto,q_auto/v1774964413/logos/shkspr?_a=BAMAMiWQ0","url":"https://daily.dev/sources/shkspr"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cryptography,fediverse,activitypub","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Terence Eden","item":"https://daily.dev/sources/shkspr"},{"@type":"ListItem","position":3,"name":"ActivityPub - Is it worth defending against replay attacks and message/signature time skew?"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/activitypub---is-it-worth-defending-against-replay-attacks-and-message-signature-time-skew--fq3lj7mfw#faq","mainEntity":[{"@type":"Question","name":"How much clock skew does Mastodon allow between the Date header and the signature creation time before rejecting an ActivityPub request?","acceptedAnswer":{"@type":"Answer","text":"Mastodon's source code suggests a window of about one hour between the Date header and the signature's created time. Other implementations vary significantly: Grishka's implementation allows only 30 seconds, while Evan Prodromou's code sets a maximum date difference of 5 minutes. The SWICG suggests roughly an hour plus a few minutes buffer to account for clock skew and timezone differences. Developers hardening federated server signature checks can track these implementation differences on daily.dev."}},{"@type":"Question","name":"Do I need to validate the published or updated timestamp in an ActivityPub message to detect fake or malicious messages?","acceptedAnswer":{"@type":"Answer","text":"No, checking the published or updated timestamp inside an ActivityPub message body is not necessary for validating legitimacy. Messages can legitimately arrive with timestamps that are minutes, days, or even months old due to slow server processing, retry delays, or servers reusing an original publish date instead of an updated one. Only obviously bogus dates, like ones far in the future or impossibly far in the past, might be worth flagging. daily.dev helps fediverse server maintainers compare real-world signature validation practices like this one."}},{"@type":"Question","name":"How do I prevent replay attacks in an ActivityPub server without relying on timestamp checks?","acceptedAnswer":{"@type":"Answer","text":"Prevent replay attacks by independently calculating the hash of the received message and validating it against the hash sent in the HTTP headers, then verifying the cryptographic signature covers that hash, and finally checking whether the message's unique ID has already been processed to enforce idempotency. If any check fails, the message should be ignored or rejected, making timestamp skew checks largely redundant for security. Teams designing federated protocol security can weigh trade-offs like these via daily.dev before shipping."}}]}
```

