AP C2S: reject Flag activities, add visibility refutes to some tests

This commit is contained in:
Phantasm 2025-12-04 23:58:44 +01:00
commit 21b2fd1e05
No known key found for this signature in database
GPG key ID: 2669E588BCC634C8
2 changed files with 11 additions and 0 deletions

View file

@ -482,6 +482,14 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
{:ok, activity}
end
# We currently lack a Flag ObjectValidator since both CommonAPI and Transmogrifier
# both send it straight to ActivityPub.flag and C2S currently has to go through
# the normal pipeline which requires an ObjectValidator.
# TODO: Add a Flag Activity ObjectValidator
defp validate_visibility(_, %{"type" => "Flag"}) do
{:error, "Flag activities aren't currently supported in C2S"}
end
defp validate_visibility(%User{} = user, %{"type" => type, "object" => object} = activity) do
with {_, %Object{} = normalized_object} <-
{:normalize, Object.normalize(object, fetch: false)},