projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
HTTP signatures respect allowlist federation
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
publisher.ex
diff --git
a/lib/pleroma/web/activity_pub/publisher.ex
b/lib/pleroma/web/activity_pub/publisher.ex
index b187d3a48040cee9c5b1b182c4ea28051fcef093..3071c1b770593a8fe3702b2bad336285a169935f 100644
(file)
--- a/
lib/pleroma/web/activity_pub/publisher.ex
+++ b/
lib/pleroma/web/activity_pub/publisher.ex
@@
-108,15
+108,28
@@
defmodule Pleroma.Web.ActivityPub.Publisher do
Config.get([:mrf_simple, :reject], [])
end
Config.get([:mrf_simple, :reject], [])
end
+ defp allowed_instances do
+ Config.get([:mrf_simple, :accept])
+ end
+
def should_federate?(url) do
%{host: host} = URI.parse(url)
def should_federate?(url) do
%{host: host} = URI.parse(url)
- quarantined_instances =
- blocked_instances()
+ with allowed <- allowed_instances(),
+ false <- Enum.empty?(allowed) do
+ allowed
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
+ |> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host)
+ else
+ _ ->
+ quarantined_instances =
+ blocked_instances()
+ |> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
+ |> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
- !Pleroma.Web.ActivityPub.MRF.subdomain_match?(quarantined_instances, host)
+ not Pleroma.Web.ActivityPub.MRF.subdomain_match?(quarantined_instances, host)
+ end
end
@spec recipients(User.t(), Activity.t()) :: list(User.t()) | []
end
@spec recipients(User.t(), Activity.t()) :: list(User.t()) | []