Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Content-Type on GET requests
Since Mastodon 4.2.5 and this security fix, Mastodon instances expected all fetched content to have as Content-Type either
application/activity+json
orapplication/ld+json; profile="https://www.w3.org/ns/activitystreams"
. Otherwise a 401 Unauthorized error is sent.This change was done here.
With this PR, all GET requests which return a
application/ld+json
Content-Type now include the ActivityStreams profile (eg.application/ld+json; profile="https://www.w3.org/ns/activitystreams"
)Fix signature validation
When POSTing to inbox, Mastodon instances now include the Content-Type in the HTTP signature (
... headers="(request-target) host date digest content-type"...
). The problem is that our API middlewares change theContent-Type
toapplication/ld+json
for easier handling... and so when we compare this header with the signature, it fails.This PR now stores a
originalHeaders
meta, which is used in HTTP signature validation.In the future, we should consider not changing the Content-Type and Accept headers, as this regularly cause issues.