Skip to content

Commit

Permalink
Use get_host/1 when extracting local referer from a request
Browse files Browse the repository at this point in the history
  • Loading branch information
jerodsanto committed Sep 19, 2023
1 parent 1e9f9eb commit b58c96e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/changelog_web/plugs/conn.ex
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ defmodule ChangelogWeb.Plug.Conn do
path = Map.get(uri, :path)

cond do
uri.host != conn.host -> {:error, "external referer"}
uri.host != get_host(conn) -> {:error, "external referer"}
String.starts_with?(path, "//") -> {:error, "invalid path"}
true -> {:ok, path}
end
Expand Down

0 comments on commit b58c96e

Please sign in to comment.