Skip to content

Use OriginalUri for Axum ActivityData #141

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Technohacker
Copy link

When the inbox route is under a nested Router, receive_activity results in failed signature checks since the received Request's URI is stripped of the nested router's prefix, causing the signed text to change.

Axum provides OriginalUri for retrieving the complete URI regardless of Router nest depth.

When the inbox path is under a nested `Router`, the received request has a URI
with the common prefix stripped. This causes incoming signatures to be considered
invalid since the path is different (see LemmyNet#107 (comment))

This commit uses `OriginalUri` for URI extraction instead, which will retrieve
the full URI regardless of router nesting
@Technohacker
Copy link
Author

Technohacker commented Apr 1, 2025

Addendum:

  1. This requires the feature original-uri on axum
  2. While I don't anticipate any users relying on the stripped URI currently, I would still consider this PR a breaking change since the URI does change between the two versions
  3. I've modified the local_federation example to use nested Routers as a simple test, since I wasn't sure on whether to add a test in the axum module

With 8c787f5, router nesting is supported correctly in axum
@Technohacker Technohacker force-pushed the axum-activitydata-originaluri branch from 1f297d6 to 1f6d6c0 Compare April 1, 2025 19:23
@Nutomic
Copy link
Member

Nutomic commented Apr 3, 2025

Thanks!

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.

2 participants