diff --git a/app/services/activitypub/fetch_remote_key_service.rb b/app/services/activitypub/fetch_remote_key_service.rb index a14567cfa7..fb98b7396d 100644 --- a/app/services/activitypub/fetch_remote_key_service.rb +++ b/app/services/activitypub/fetch_remote_key_service.rb @@ -36,6 +36,8 @@ class ActivityPub::FetchRemoteKeyService < BaseService private def keypair_from_actor_json(actor_uri, actor_json) + return if non_matching_uri_hosts?(actor_uri, @uri) + actor = find_actor(actor_uri, actor_json) return if actor.nil? diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index 5cd3413e4f..5c991e3c52 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -287,6 +287,7 @@ class ActivityPub::ProcessAccountService < BaseService end key_id = value + next if non_matching_uri_hosts?(@account.uri, key_id) # Key is fetched without ID validation because of a GoToSocial bug value = fetch_resource_without_id_validation(key_id) @@ -295,7 +296,7 @@ class ActivityPub::ProcessAccountService < BaseService # Special handling for GoToSocial which returns the whole actor for the key ID value = first_of_value(value['publicKey']) if value.is_a?(Hash) && value.key?('publicKey') - next unless value['owner'] == @account.uri + next unless value.present? && value['owner'] == @account.uri key = value['publicKeyPem'] next if key.nil?