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 #5059 - Stop processing payload if it's from local account #5100

Merged
merged 1 commit into from Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/lib/activitypub/activity/announce.rb
Expand Up @@ -25,6 +25,8 @@ def perform

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'])
Expand Down
2 changes: 1 addition & 1 deletion app/services/activitypub/process_collection_service.rb
Expand Up @@ -9,7 +9,7 @@ def call(body, account)

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'
Expand Down
4 changes: 2 additions & 2 deletions spec/services/activitypub/process_collection_service_spec.rb
@@ -1,7 +1,7 @@
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
{
Expand All @@ -24,7 +24,7 @@
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!)
Expand Down