π blog!
-
I think the #RFC9421 HTTP Signature algorithm should be explicitly included in #Mastodon's requests.
Feedback welcome - especially those explaining politely why I'm a wrong about this.
https://github.com/mastodon/mastodon/issues/29905#issuecomment-5440336919
@Terence Eden If the verifier chooses which algorithm to use from this header, without double-checking it against the key, there's a chance it'll be vulnerable to an "algorithm confusion attack".
Here's what that looks like in the case of JWTs; the same problem could happen with RFC9421.
The safe way to work out which algorithm to use is to dereference thekeyidand then choose the algorithm which matches the type of the returned key. -
@Terence Eden If the verifier chooses which algorithm to use from this header, without double-checking it against the key, there's a chance it'll be vulnerable to an "algorithm confusion attack".
Here's what that looks like in the case of JWTs; the same problem could happen with RFC9421.
The safe way to work out which algorithm to use is to dereference thekeyidand then choose the algorithm which matches the type of the returned key.@fentiger I think that's where I'm getting confused.
I'm getting the public key from the Mastodon user - but how do tell what algorithm the key itself uses?
-
@fentiger I think that's where I'm getting confused.
I'm getting the public key from the Mastodon user - but how do tell what algorithm the key itself uses?
@Terence Eden You should be able to find out from your crypto library after you've decoded the key from PEM.
(I don't think anyone uses anything other than RSA in thepublicKeyPemfield, but I'm not sure it's safe to assume that.) -
@Terence Eden You should be able to find out from your crypto library after you've decoded the key from PEM.
(I don't think anyone uses anything other than RSA in thepublicKeyPemfield, but I'm not sure it's safe to assume that.)@fentiger
If I decode the PEM, all I get is
Type: RSA Public Key
Key Size: 2048 bitsNothing to say which algorithm it uses.
Feel free to tell me what incredibly obvious thing I'm missing

-
I think the #RFC9421 HTTP Signature algorithm should be explicitly included in #Mastodon's requests.
Feedback welcome - especially those explaining politely why I'm a wrong about this.
https://github.com/mastodon/mastodon/issues/29905#issuecomment-5440336919
Hey, #Mastodon and #ActivityPub developers.
How much skew do you allow before rejecting a message?
I've just received something where the header is signed:
Mon, 31 Aug 2026 20:09:54 GMTBut the ActivityPub message was published:
Mon, 31 Aug 2026 19:58:36 GMTThat's a little over 10 minutes. Is that too much? Should I not care as long as the signature validates?
-
Hey, #Mastodon and #ActivityPub developers.
How much skew do you allow before rejecting a message?
I've just received something where the header is signed:
Mon, 31 Aug 2026 20:09:54 GMTBut the ActivityPub message was published:
Mon, 31 Aug 2026 19:58:36 GMTThat's a little over 10 minutes. Is that too much? Should I not care as long as the signature validates?
@Edent you'd be surprised how many servers don't have proper NTP sync enabled and can have system clocks off by *hours*.
-
Hey, #Mastodon and #ActivityPub developers.
How much skew do you allow before rejecting a message?
I've just received something where the header is signed:
Mon, 31 Aug 2026 20:09:54 GMTBut the ActivityPub message was published:
Mon, 31 Aug 2026 19:58:36 GMTThat's a little over 10 minutes. Is that too much? Should I not care as long as the signature validates?
@Edent activitypub.bot gives a tolerance of 5 minutes.
https://github.com/evanp/activitypub-bot/blob/main/lib%2Fhttpsignatureauthenticator.js#L8
-
@Edent activitypub.bot gives a tolerance of 5 minutes.
https://github.com/evanp/activitypub-bot/blob/main/lib%2Fhttpsignatureauthenticator.js#L8
@evan Thanks - I had mine at two minutes.
I'm starting to see more exceeding 10 minutes.
I wonder what the actual risk is of accepting something with that long a delay? -
Hey, #Mastodon and #ActivityPub developers.
How much skew do you allow before rejecting a message?
I've just received something where the header is signed:
Mon, 31 Aug 2026 20:09:54 GMTBut the ActivityPub message was published:
Mon, 31 Aug 2026 19:58:36 GMTThat's a little over 10 minutes. Is that too much? Should I not care as long as the signature validates?
@Edent I've seen my Sidekiq queues get multiple minutes long on occasion, so it doesn't seem unreasonable.
-
@evan Thanks - I had mine at two minutes.
I'm starting to see more exceeding 10 minutes.
I wonder what the actual risk is of accepting something with that long a delay?@Edent replay attacks, I'd guess.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register Login