Skip to content
Snippets Groups Projects
Commit cf7fbf2c authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Fix #5059 - Stop processing payload if it's from local account (#5100)

parent 91e5b0df
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,8 @@ class ActivityPub::Activity::Announce < ActivityPub::Activity
def fetch_remote_original_status
if object_uri.start_with?('http')
return if ActivityPub::TagManager.instance.local_uri?(object_uri)
ActivityPub::FetchRemoteStatusService.new.call(object_uri)
elsif @object['url'].present?
::FetchRemoteStatusService.new.call(@object['url'])
......
......@@ -9,7 +9,7 @@ class ActivityPub::ProcessCollectionService < BaseService
return unless supported_context?
return if different_actor? && verify_account!.nil?
return if @account.suspended?
return if @account.suspended? || @account.local?
case @json['type']
when 'Collection', 'CollectionPage'
......
require 'rails_helper'
RSpec.describe ActivityPub::ProcessCollectionService do
let(:actor) { Fabricate(:account) }
let(:actor) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/account') }
let(:payload) do
{
......@@ -24,7 +24,7 @@ RSpec.describe ActivityPub::ProcessCollectionService do
describe '#call' do
context 'when actor is the sender'
context 'when actor differs from sender' do
let(:forwarder) { Fabricate(:account) }
let(:forwarder) { Fabricate(:account, domain: 'example.com', uri: 'http://example.com/other_account') }
it 'processes payload with sender if no signature exists' do
expect_any_instance_of(ActivityPub::LinkedDataSignature).not_to receive(:verify_account!)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment