Skip to content
Snippets Groups Projects
Commit 9a444c0d authored by lain's avatar lain
Browse files

Merge branch 'bugfix/websub-hardening' into 'develop'

websub: improve error handling

See merge request pleroma/pleroma!670
parents d1c40cbc 17da432d
Branches
No related tags found
No related merge requests found
......@@ -121,6 +121,12 @@ defmodule Pleroma.Web.Websub do
end
end
def incoming_subscription_request(user, params) do
Logger.info("Unhandled WebSub request for #{user.nickname}: #{inspect(params)}")
{:error, "Invalid WebSub request"}
end
defp get_subscription(topic, callback) do
Repo.get_by(WebsubServerSubscription, topic: topic, callback: callback) ||
%WebsubServerSubscription{}
......
......@@ -67,6 +67,13 @@ defmodule Pleroma.Web.Websub.WebsubController do
end
end
def websub_subscription_confirmation(conn, params) do
Logger.info("Invalid WebSub confirmation request: #{inspect(params)}")
conn
|> send_resp(500, "Invalid parameters")
end
def websub_incoming(conn, %{"id" => id}) do
with "sha1=" <> signature <- hd(get_req_header(conn, "x-hub-signature")),
signature <- String.downcase(signature),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment