Compare commits

...

6 commits

6 changed files with 23 additions and 3 deletions

View file

@ -76,6 +76,7 @@ pipeline:
- *clean - *clean
- echo "import Config" > config/prod.secret.exs - echo "import Config" > config/prod.secret.exs
- *setup-hex - *setup-hex
- *mix-clean
- *tag-build - *tag-build
- mix deps.get --only prod - mix deps.get --only prod
- mix release --path release - mix release --path release

View file

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
## Fixed
- Issue where a bad inbox URL could break federation
## 2023.08 ## 2023.08
## Added ## Added

View file

@ -115,13 +115,18 @@ defp allowed_instances do
def should_federate?(url) do def should_federate?(url) do
%{host: host} = URI.parse(url) %{host: host} = URI.parse(url)
with allowed <- allowed_instances(), with {nil, false} <- {nil, is_nil(host)},
allowed <- allowed_instances(),
false <- Enum.empty?(allowed) do false <- Enum.empty?(allowed) do
allowed allowed
|> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples() |> Pleroma.Web.ActivityPub.MRF.instance_list_from_tuples()
|> Pleroma.Web.ActivityPub.MRF.subdomains_regex() |> Pleroma.Web.ActivityPub.MRF.subdomains_regex()
|> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host) |> Pleroma.Web.ActivityPub.MRF.subdomain_match?(host)
else else
# oi!
{nil, true} ->
false
_ -> _ ->
quarantined_instances = quarantined_instances =
blocked_instances() blocked_instances()

View file

@ -34,7 +34,9 @@ def perform(%Plug.Conn{assigns: assigns} = conn, %{scopes: scopes} = options) do
permissions = Enum.join(missing_scopes, " #{op} ") permissions = Enum.join(missing_scopes, " #{op} ")
error_message = error_message =
dgettext("errors", "Insufficient permissions: %{permissions}.", permissions: permissions) dgettext("errors", "Insufficient permissions: %{permissions}.",
permissions: permissions
)
conn conn
|> put_resp_content_type("application/json") |> put_resp_content_type("application/json")

View file

@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
def project do def project do
[ [
app: :pleroma, app: :pleroma,
version: version("3.10.3"), version: version("3.10.4"),
elixir: "~> 1.14", elixir: "~> 1.14",
elixirc_paths: elixirc_paths(Mix.env()), elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix] ++ Mix.compilers(), compilers: [:phoenix] ++ Mix.compilers(),

View file

@ -487,4 +487,11 @@ test "publish to url with with different ports" do
) )
end end
end end
describe "should_federate/1" do
test "should not obliterate itself if the inbox URL is bad" do
url = "/inbox"
refute Pleroma.Web.ActivityPub.Publisher.should_federate?(url)
end
end
end end