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:
parent
f22caeff53
commit
c81b1261dc
2 changed files with 13 additions and 2 deletions
|
|
@ -10,7 +10,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UserValidator do
|
|||
addressing and visibility checks, and map signature key ids back to
|
||||
the actor. If an actor could point any of these at another host, it
|
||||
could redirect our signed deliveries or claim another actor's
|
||||
collections. Optional fields are only checked when present.
|
||||
collections. Optional fields are only checked when present; null and
|
||||
empty strings count as missing.
|
||||
|
||||
Based on Akkoma's UserValidator.
|
||||
"""
|
||||
|
|
@ -38,7 +39,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.UserValidator do
|
|||
|
||||
def validate(_data, _meta), do: {:error, "Actor has no id"}
|
||||
|
||||
defp same_origin?(_id, nil), do: true
|
||||
defp same_origin?(_id, value) when value in [nil, ""], do: true
|
||||
defp same_origin?(id, %{"id" => value}), do: same_origin?(id, value)
|
||||
defp same_origin?(id, value), do: Containment.same_origin(id, value) == :ok
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue