Edent,
@Edent@mastodon.social avatar

Once again doing battle with http signatures.

They work when I POST, but fail to be validated when I GET.

I'm sure there's a simple explanation...

Edent,
@Edent@mastodon.social avatar

So, if I've got this right about HTTP Signatures.

➡ You send me a request.
🔍 I check the digest matches the contents.
📆 I check the date is roughly correct.
⬅ I request your public key.
🖊 That requires me to sign a request with my private key.
🔑 I get your public key.
🕵 I validate your request by checking the signature matches the entire request - including digest.

But…! When I request your public key, you have to validate my public key. Which leads us into a loop?

goalexandre,

@Edent if you're the server receiving a request you won't validate the client certificate unless you require a client certificate. If that's the case, the client is supposed to send its client key with the request.

Edent,
@Edent@mastodon.social avatar

@goalexandre I might be misunderstanding, but when Mastodon uses Authorised Fetch - that requires the server to validate all requests. Including for profile information.

There's no point sending the public with the request though, is there? You need to be able to validate it separately.

goalexandre,

@Edent the http signature that the client sends will include everything (own certificate, intermediate certificates, root certificate, validity dates, signatures, etc). The server will check that information and trust it only if the Certificate Authorities that issued the whole chain of the client certificate are trusted by the server. The server won't need to perform an additional request to validate or trust the client certificate, it already has what it needs to trust a client certificate.

Edent,
@Edent@mastodon.social avatar

@goalexandre Ah, I think we're talking at cross purposes. I'm talking about https://www.rfc-editor.org/rfc/rfc9421.html

goalexandre,

@Edent There's an old mastodon issue that kinda explains (and fixed) that behavior: https://github.com/mastodon/mastodon/issues/12375
I also found the following video to be somewhat useful to understand the whole process: https://www.youtube.com/watch?v=QdUZaYeQblY

goalexandre,

@Edent You're right, I was not talking about http message signatures, but TLS server certificates validation/trust. By reading the link you sent, it looks like the validation process is explained in "3.2. Verifying a Signature, Paragraph 5.". From that link, the validation information would be either pre-configured in the server or included in the signature. If the details are included, the server collects that material without performing signature validation and even authentication.

Edent, (edited )
@Edent@mastodon.social avatar

Even more HTTP Message Signature weirdness.

My server receives a lot of "Delete" requests from server.

Those requests are signed.

I try to validate the signature but… the user is deleted!

So I try to retrieve the user's Public Key at, for example, https://nrw.social/@Faxy.json#main-key but get an error.

I suppose an HTTP 410 is a pretty good indication that the user has been deleted. And I might have previously cached the key. But it does feel a little bit pointless.

j3j5,
@j3j5@hachyderm.io avatar

@Edent it's astonishing the amount of DELETE requests mastodon sends around. I don't have exact numbers but it's almost certainly the nr 1 request I receive from the other servers by far.

Edent,
@Edent@mastodon.social avatar

@j3j5 yeah, dozens of MB from servers I've never heard of.

j3j5,
@j3j5@hachyderm.io avatar

@Edent yeah, exactly! I started getting the requests the first week of going live and most of the servers I've never heard of (much less interacted with). Where do they even got my domain from?? Haha, the magic of federation I guess

FenTiger,
@FenTiger@mastodon.social avatar

@Edent Are you including "Digest" in the list of signed headers?

You should for a POST, but shouldn't for a GET, which doesn't have a Digest.

I found this out the hard way... ;)

Edent,
@Edent@mastodon.social avatar

@FenTiger ooooh! That might be it!

Edent,
@Edent@mastodon.social avatar

@FenTiger and the (request-target): is probably get rather than post?

FenTiger,
@FenTiger@mastodon.social avatar

@Edent Yes.

Edent,
@Edent@mastodon.social avatar

@FenTiger you star! Thanks 🙂

dominik,
@dominik@nona.social avatar

@Edent webfinger has to be application/jrd+json and all the other json replies have to be application/activity+json

Edent,
@Edent@mastodon.social avatar

@dominik thanks, that's helpful.
I'm able to sign messages when I post. But using the same code to get a user's profile is failing.
I'll have a look through your code.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • GTA5RPClips
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • Durango
  • cubers
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • ngwrru68w68
  • kavyap
  • tacticalgear
  • ethstaker
  • JUstTest
  • InstantRegret
  • Leos
  • normalnudes
  • everett
  • khanakhh
  • osvaldo12
  • cisconetworking
  • modclub
  • anitta
  • tester
  • megavids
  • provamag3
  • lostlight
  • All magazines