Renew HTTP signatures when following redirects #973

Merged
Oneric merged 13 commits from Oneric/akkoma:httpsig_redirect_resign into develop 2025-10-04 16:25:50 +00:00
Owner

Finally fixing our side of #731

This means we can now fetch posts from e.g. Mastodon and PeerTube’s remote post display links (since they redirect to the original) even if the actual author’s instance requires authorized fetch.

Unfortunately most other implementations remain buggy afaik, so we have to keep the awful "route alias" handling in our own verification logic for now (though, with lazy route-alias evaluation this is at least no longer as costly as it used to be)

Initial checks and mix test seem good, but let’s have it spend some time in prod testing before merge to be sure; more testers welcome though

Finally fixing our side of #731 This means we can now fetch posts from e.g. Mastodon and PeerTube’s remote post display links *(since they redirect to the original)* even if the actual author’s instance requires authorized fetch. Unfortunately most other implementations remain buggy afaik, so we have to keep the awful "route alias" handling in our own verification logic for now (though, with lazy route-alias evaluation this is at least no longer as costly as it used to be) Initial checks and `mix test` seem good, but let’s have it spend some time in prod testing before merge to be sure; more testers welcome though
Oneric force-pushed httpsig_redirect_resign from ccbf5ff204
Some checks failed
ci/woodpecker/pr/test/2 Pipeline is pending
ci/woodpecker/pr/test/1 Pipeline failed
to e116558dcf
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
2025-08-30 21:02:22 +00:00
Compare
Oneric force-pushed httpsig_redirect_resign from e116558dcf
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
to e8d217f3c7
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
2025-09-06 14:13:20 +00:00
Compare
floatingghost left a comment
Owner

this seems fine, could do with an extra test for the condition though methinks

this seems fine, could do with an extra test for the condition though methinks
@ -414,1 +380,3 @@
|> sign_fetch(id, date)
http_opts =
if Pleroma.Config.get([:activitypub, :sign_object_fetches]) do

part of me wonders why we even have this option

part of me wonders why we even have this option
Author
Owner

If we drop it a bunch of tests fail since they only mocked requests with only a content-type header and nothing more. I suspect this and lack of motivation to fix the mocks is the main reason for this and the (actually limited to :test only) option to not set the user-agent header existing

If we drop it a bunch of tests fail since they only mocked requests with _only_ a `content-type` header and nothing more. I suspect this and lack of motivation to fix the mocks is the main reason for this and the (actually limited to `:test` only) option to not set the user-agent header existing
Oneric force-pushed httpsig_redirect_resign from e8d217f3c7
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
to 8066db8e0c
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
2025-09-07 00:45:00 +00:00
Compare
Author
Owner

could do with an extra test for the condition though

if you mean the Pleroma.Config.get([:activitypub, :sign_object_fetches]) check, there’s already a test for it (and it’s updated in the diff)


As for the actual signature logic, I’m pretty confident it works well without unwatend drawbacks now.

But turns out HTTP was being sloppy and mixed and duplicated all Tesla options into adapter options so the key redaction for logs didn’t actually work. (It only redacted the top-level copy not the copy in adapter options).
To (probably) fix this I had to force adapter options into a subkey and go through all uses of Pleroma.HTTP functions. In the process I noticed a bunch of obsolete unused or unneeded modules and deleted them. This makes this quite a bigger change — but also a net removal of ~260 lines of codes

> could do with an extra test for the condition though if you mean the `Pleroma.Config.get([:activitypub, :sign_object_fetches])` check, there’s already a test for it (and it’s updated in the diff) --- As for the actual signature logic, I’m pretty confident it works well without unwatend drawbacks now. But turns out `HTTP` was being sloppy and mixed and duplicated all Tesla options into adapter options so the key redaction for logs didn’t actually work. (It only redacted the top-level copy not the copy in adapter options). To (probably) fix this I had to force adapter options into a subkey and go through all uses of `Pleroma.HTTP` functions. In the process I noticed a bunch of obsolete unused or unneeded modules and deleted them. This makes this quite a bigger change — but also a net removal of ~260 lines of codes
Oneric force-pushed httpsig_redirect_resign from 8066db8e0c
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
to a5b727ef81
Some checks failed
ci/woodpecker/pr/test/2 Pipeline is pending
ci/woodpecker/pr/test/1 Pipeline failed
2025-09-07 09:25:35 +00:00
Compare
Oneric force-pushed httpsig_redirect_resign from a5b727ef81
Some checks failed
ci/woodpecker/pr/test/2 Pipeline is pending
ci/woodpecker/pr/test/1 Pipeline failed
to b9f79f333f
All checks were successful
ci/woodpecker/pr/test/1 Pipeline was successful
ci/woodpecker/pr/test/2 Pipeline was successful
2025-09-07 09:34:19 +00:00
Compare
Oneric merged commit 8c33eed93e into develop 2025-10-04 16:25:50 +00:00
Oneric deleted branch httpsig_redirect_resign 2025-10-04 16:25:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AkkomaGang/akkoma!973
No description provided.