Fix ResolveAccountService accepting mismatching acct: URI (#15368)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
ThibG 2020-12-19 00:26:53 +01:00 committed by GitHub
parent 406adfca27
commit 36b9b8deaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 10 deletions

View file

@ -46,7 +46,7 @@ class ResolveAccountService < BaseService
# Now it is certain, it is definitely a remote account, and it
# either needs to be created, or updated from fresh data
process_account!
fetch_account!
rescue Webfinger::Error, WebfingerRedirectError, Oj::ParseError => e
Rails.logger.debug "Webfinger query for #{@uri} failed: #{e}"
nil
@ -99,16 +99,12 @@ class ResolveAccountService < BaseService
acct.gsub(/\Aacct:/, '').split('@')
end
def process_account!
def fetch_account!
return unless activitypub_ready?
RedisLock.acquire(lock_options) do |lock|
if lock.acquired?
@account = Account.find_remote(@username, @domain)
next if actor_json.nil?
@account = ActivityPub::ProcessAccountService.new.call(@username, @domain, actor_json)
@account = ActivityPub::FetchRemoteAccountService.new.call(actor_url)
else
raise Mastodon::RaceConditionError
end