From 368e085144cc3bea501dc14a783f32cd696cb3af Mon Sep 17 00:00:00 2001 From: lain Date: Sun, 11 Mar 2018 14:47:37 +0100 Subject: [PATCH] Don't validate on missing public key. --- lib/pleroma/web/http_signatures/http_signatures.ex | 1 + test/support/httpoison_mock.ex | 7 +++++++ test/web/http_sigs/http_sig_test.exs | 1 + 3 files changed, 9 insertions(+) diff --git a/lib/pleroma/web/http_signatures/http_signatures.ex b/lib/pleroma/web/http_signatures/http_signatures.ex index 09ac4a374..d0695cb16 100644 --- a/lib/pleroma/web/http_signatures/http_signatures.ex +++ b/lib/pleroma/web/http_signatures/http_signatures.ex @@ -47,6 +47,7 @@ def validate_conn(conn) do else e -> Logger.debug("Could not public key!") + false end end diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index ad9be9aef..a8b1a60c0 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -401,6 +401,13 @@ def get("https://niu.moe/users/rye", ["Accept": "application/activity+json"], _) }} end + def get("https://mst3k.interlinked.me/users/luciferMysticus", ["Accept": "application/activity+json"], _) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/lucifermysticus.json") + }} + end + def get("https://mstdn.io/users/mayuutann", ["Accept": "application/activity+json"], _) do {:ok, %Response{ status_code: 200, diff --git a/test/web/http_sigs/http_sig_test.exs b/test/web/http_sigs/http_sig_test.exs index b54afa3fb..b2bf8d61b 100644 --- a/test/web/http_sigs/http_sig_test.exs +++ b/test/web/http_sigs/http_sig_test.exs @@ -183,6 +183,7 @@ test "this too" do {"(request-target)", "post /inbox"} ] } + assert HTTPSignatures.validate_conn(conn) end end