chinwagsocial/app/services/activitypub/fetch_remote_account_service.rb
Claire c8849d6cee
Fix unbounded recursion in account discovery (#22025)
* Fix trying to fetch posts from other users when fetching featured posts

* Rate-limit discovery of new subdomains

* Put a limit on recursively discovering new accounts
2022-12-07 00:15:24 +01:00

13 lines
584 B
Ruby

# frozen_string_literal: true
class ActivityPub::FetchRemoteAccountService < ActivityPub::FetchRemoteActorService
# Does a WebFinger roundtrip on each call, unless `only_key` is true
def call(uri, id: true, prefetched_body: nil, break_on_redirect: false, only_key: false, suppress_errors: true, request_id: nil)
actor = super
return actor if actor.nil? || actor.is_a?(Account)
Rails.logger.debug "Fetching account #{uri} failed: Expected Account, got #{actor.class.name}"
raise Error, "Expected Account, got #{actor.class.name}" unless suppress_errors
end
end