summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2023-05-29 14:16:03 -0400
committerMark Felder <feld@feld.me>2023-05-29 14:16:03 -0400
commita60dd0d92dae2471025827bc57d3cf3194003110 (patch)
treee6987e6465a9aa9f61d2d57ed2cbf92578f54e14 /test
parent843fcca5b4d022e4c088d4a60839b4a286500148 (diff)
downloadpleroma-a60dd0d92dae2471025827bc57d3cf3194003110.tar.gz
pleroma-a60dd0d92dae2471025827bc57d3cf3194003110.zip
Validate Host header matches expected value before allowing access to Uploads
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/plugs/uploaded_media_plug_test.exs14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pleroma/web/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
index 8323ff6ab..262c8c288 100644
--- a/test/pleroma/web/plugs/uploaded_media_plug_test.exs
+++ b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
@@ -40,4 +40,18 @@ defmodule Pleroma.Web.Plugs.UploadedMediaPlugTest do
&(&1 == {"content-disposition", ~s[inline; filename="\\"cofe\\".gif"]})
)
end
+
+ test "denies access to media if wrong Host", %{
+ attachment_url: attachment_url
+ } do
+ conn = get(build_conn(), attachment_url)
+
+ assert conn.status == 200
+
+ clear_config([Pleroma.Upload, :base_url], "http://media.localhost/")
+
+ conn = get(build_conn(), attachment_url)
+
+ assert conn.status == 400
+ end
end