fix(federation): treat empty actor fields as missing

An empty inbox, collection or key id was rejected as being on another
host. Treat empty strings like null and only check fields with a value.
This commit is contained in:
Lain Soykaf 2026-10-27 22:02:31 +04:00
commit c81b1261dc
No known key found for this signature in database
2 changed files with 13 additions and 2 deletions

View file

@ -32,6 +32,16 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UserValidatorTest do
end
end
test "treats empty and null fields as missing" do
data =
actor()
|> Map.merge(%{"inbox" => "", "followers" => nil, "following" => "", "featured" => ""})
|> put_in(["endpoints", "sharedInbox"], "")
|> put_in(["publicKey", "id"], "")
assert {:ok, _, _} = UserValidator.validate(data, [])
end
for field <- ["inbox", "followers", "following", "featured"] do
test "rejects an actor whose #{field} is on another host" do
data = Map.put(actor(), unquote(field), "https://victim.example/users/lain/x")