Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Mastodon compatibility #1238

Merged
merged 1 commit into from
Mar 1, 2024
Merged

Fix Mastodon compatibility #1238

merged 1 commit into from
Mar 1, 2024

Conversation

srosset81
Copy link
Contributor

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 or application/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 the Content-Type to application/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.

@srosset81 srosset81 merged commit 9780af4 into next Mar 1, 2024
@srosset81 srosset81 deleted the fix-mastodon-compatibility branch March 1, 2024 12:13
@srosset81 srosset81 mentioned this pull request Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant