Validate Host header matches expected value before allowing access to Uploads
This commit is contained in:
parent
843fcca5b4
commit
a60dd0d92d
2 changed files with 24 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue