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

Refactor ActivityPub handling to prepare for non-Account actors #19212

Merged
merged 9 commits into from
Sep 21, 2022

Conversation

ClearlyClaire
Copy link
Contributor

@ClearlyClaire ClearlyClaire commented Sep 21, 2022

Group (#19059) federation will most probably work by representing group actors as something different from Account. Therefore, this PR prepares for handling requests to and from ActivityPub actors that would not be represented as Account in Mastodon.

Currently, the only actors are Account, and this PR does not change that. #19059 will likely introduce Group that will implement a common interface with Account through:

  • uri
  • inbox_url
  • keypair

Changes include:

  • Added ActivityPub::TagManager#uri_to_actor(uri) to replace the uses of ActivityPub::TagManager#uri_to_resource(uri, Account), with the intent that it will potentially return a Group object in the future
  • Added ActivityPub::FetchRemoteActorService, with the intent that it will potentially return a Group object in the future. Kept ActivityPub::FetchRemoteAccountService as a wrapper that additionally checks the result is an Account
  • Added signed_request_actor to the SignatureVerification concern, with the intent that it will potentially return a Group object in the future. signed_request_account is kept as a wrapper that additionally checks the result is an Account
  • Renamed require_signature! to require_account_signature! in the SignatureVerification concern. Added require_actor_signature! for use cases where we don't require the signer to be an Account
  • Changed ActivityPub::FetchRemoteKeyService to potentially return non-Account actors
  • Renamed ActivityPub::LinkedDataSignature#verify_account! to ActivityPub::LinkedDataSignature#verify_actor! and allowed it to potentially return non-Account actors
  • Added an optional actor_type parameter to ActivityPub::ProcessingWorker so it can handle non-Account actors (ActivityPub::ProcessCollectionService has been changed to explicitly skip processing any non-Account actor for now)
  • Changed ActivityPub::InboxesController to accept potentially non-Account actors

@ClearlyClaire ClearlyClaire force-pushed the refactor/non-account-actors branch 3 times, most recently from b6b08a1 to b32a4d7 Compare September 21, 2022 13:16
@ClearlyClaire ClearlyClaire marked this pull request as ready for review September 21, 2022 13:59
@Gargron Gargron merged commit 8cf7006 into mastodon:main Sep 21, 2022
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Sep 22, 2022
…odon#19212)

* Move ActivityPub::FetchRemoteAccountService to ActivityPub::FetchRemoteActorService

ActivityPub::FetchRemoteAccountService is kept as a wrapper for when the actor is
specifically required to be an Account

* Refactor SignatureVerification to allow non-Account actors

* fixup! Move ActivityPub::FetchRemoteAccountService to ActivityPub::FetchRemoteActorService

* Refactor ActivityPub::FetchRemoteKeyService to potentially return non-Account actors

* Refactor inbound ActivityPub payload processing to accept non-Account actors

* Refactor inbound ActivityPub processing to accept activities relayed through non-Account

* Refactor how Account key URIs are built

* Refactor Request and drop unused key_id_format parameter

* Rename ActivityPub::Dereferencer `signature_account` to `signature_actor`
ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this pull request Sep 24, 2022
Gargron pushed a commit that referenced this pull request Sep 24, 2022
nametoolong pushed a commit to nametoolong/nuage that referenced this pull request Sep 26, 2022
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 19, 2022
…odon#19212)

* Move ActivityPub::FetchRemoteAccountService to ActivityPub::FetchRemoteActorService

ActivityPub::FetchRemoteAccountService is kept as a wrapper for when the actor is
specifically required to be an Account

* Refactor SignatureVerification to allow non-Account actors

* fixup! Move ActivityPub::FetchRemoteAccountService to ActivityPub::FetchRemoteActorService

* Refactor ActivityPub::FetchRemoteKeyService to potentially return non-Account actors

* Refactor inbound ActivityPub payload processing to accept non-Account actors

* Refactor inbound ActivityPub processing to accept activities relayed through non-Account

* Refactor how Account key URIs are built

* Refactor Request and drop unused key_id_format parameter

* Rename ActivityPub::Dereferencer `signature_account` to `signature_actor`
kadoshita pushed a commit to kadoshita/mastodon that referenced this pull request Nov 19, 2022
ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this pull request Jul 6, 2023
…odon#19212)

* Move ActivityPub::FetchRemoteAccountService to ActivityPub::FetchRemoteActorService

ActivityPub::FetchRemoteAccountService is kept as a wrapper for when the actor is
specifically required to be an Account

* Refactor SignatureVerification to allow non-Account actors

* fixup! Move ActivityPub::FetchRemoteAccountService to ActivityPub::FetchRemoteActorService

* Refactor ActivityPub::FetchRemoteKeyService to potentially return non-Account actors

* Refactor inbound ActivityPub payload processing to accept non-Account actors

* Refactor inbound ActivityPub processing to accept activities relayed through non-Account

* Refactor how Account key URIs are built

* Refactor Request and drop unused key_id_format parameter

* Rename ActivityPub::Dereferencer `signature_account` to `signature_actor`
ClearlyClaire added a commit to ClearlyClaire/mastodon that referenced this pull request Jul 6, 2023
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.

None yet

2 participants