Fix fetching unknown key when it's not the actor's first, and add error handling for unavailable keys (#39512)
This commit is contained in:
1 parent
e864238991
commit
2a80a07854
3 files changed
+21
-1
No files matched your search
@@ -77,6 +77,6 @@ class ActivityPub::FetchRemoteKeyService < BaseService
|
||||
end
|
||||
|
||||
def confirmed_owner?
|
||||
value_or_id(@owner['publicKey']) == @json['id']
|
||||
as_array(@owner['publicKey']).map { |value| value_or_id(value) }.include?(@json['id'])
|
||||
end
|
||||
end
|
||||
@@ -290,6 +290,7 @@ class ActivityPub::ProcessAccountService < BaseService
|
||||
|
||||
# Key is fetched without ID validation because of a GoToSocial bug
|
||||
value = fetch_resource_without_id_validation(key_id)
|
||||
next if value.blank?
|
||||
|
||||
# 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')
|
||||
|
||||
Reference in new issue
Block a user