Fix invalid Date HTTP header when signing fetch requests #619

Merged
floatingghost merged 1 commit from Clovis/akkoma:fix-503 into develop 2023-08-07 15:23:21 +00:00
Contributor

Fix #503

While trying to follow a relay, I encountered the same error. I was able to mitigate it by deactivating the ActivityPub.SignObjectFetch setting.

From what I understand, this bug is encountered on non-english servers because of those lines:

https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/object/fetcher.ex#L271-L276

https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/object/fetcher.ex#L230-L236

https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/signature.ex#L78-L80

Having the Pleroma.Config.get([:activitypub, :sign_object_fetches]) set to true cause the server to add a Date header on its requests. However, it seems that this date is translated at some point (probably following OS locale settings). On my config it generates lun., 07 août 2023 10:32:16 GMT (for monday, 07 august) with "û" not being a valid ASCII char.

This bug seems to be rather important since in the current state, we do not follow the Date HTTP header format in some cases: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date

Fix https://akkoma.dev/AkkomaGang/akkoma/issues/503 While trying to follow a relay, I encountered the same error. I was able to mitigate it by deactivating the `ActivityPub.SignObjectFetch` setting. From what I understand, this bug is encountered on non-english servers because of those lines: https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/object/fetcher.ex#L271-L276 https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/object/fetcher.ex#L230-L236 https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/lib/pleroma/signature.ex#L78-L80 Having the `Pleroma.Config.get([:activitypub, :sign_object_fetches])` set to true cause the server to add a `Date` header on its requests. However, it seems that this date is translated at some point (probably following OS locale settings). On my config it generates `lun., 07 août 2023 10:32:16 GMT` (for monday, 07 august) with "û" not being a valid ASCII char. This bug seems to be rather important since in the current state, we do not follow the Date HTTP header format in some cases: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date
Clovis added 1 commit 2023-08-07 12:46:53 +00:00
Fix invalid Date HTTP header when signing fetch requests
Some checks failed
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/build-arm64 unknown status
ci/woodpecker/pr/build-amd64 unknown status
ci/woodpecker/pr/docs unknown status
fc3cc61768
#503

i was about to type "could you add a test" but apparently we already have one and it would have failed if your locale wasn't EN i guess

funny that nobody found that failure sooner

thanks!

i was about to type "could you add a test" but apparently we [already have one](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop/test/pleroma/signature_test.exs#L133) and it would have failed if your locale wasn't EN i guess funny that nobody found that failure sooner thanks!
floatingghost merged commit 3f1e2b0b3b into develop 2023-08-07 15:23:21 +00:00
floatingghost deleted branch fix-503 2023-08-07 15:23:21 +00:00
Sign in to join this conversation.
No description provided.