Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85648946
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index 7c04fdc51..3f67ae406 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -2361,6 +2361,7 @@ defmodule Pleroma.User do
"profile_url" => profile_url,
"subject" => "acct:" <> acct
}} <- WebFinger.finger(account),
+ true <- is_binary(ap_id) and ap_id != "",
true <- same_profile_url?(uri, profile_url) do
ActivityPub.make_user_from_ap_id(ap_id, nickname_from_acct: acct)
else
diff --git a/test/pleroma/user_search_test.exs b/test/pleroma/user_search_test.exs
index ec8e1b2ee..6e0656d43 100644
--- a/test/pleroma/user_search_test.exs
+++ b/test/pleroma/user_search_test.exs
@@ -317,6 +317,34 @@ defmodule Pleroma.UserSearchTest do
User.search(profile_url, resolve: true, for_user: user)
end
+ test "does not crash when the WebFinger response has no AP id but a matching profile URL" do
+ _user = insert(:user)
+ profile_url = "https://www.threads.example/@alice"
+
+ Tesla.Mock.mock(fn
+ %{url: "https://www.threads.example/.well-known/host-meta"} ->
+ {:ok, %Tesla.Env{status: 404}}
+
+ %{url: "https://www.threads.example/.well-known/webfinger?resource=acct:alice@www.threads.example"} ->
+ Tesla.Mock.json(%{
+ "subject" => "acct:alice@www.threads.example",
+ "links" => [
+ %{"rel" => "self", "type" => "application/activity+json", "href" => nil},
+ %{
+ "rel" => "http://webfinger.net/rel/profile-page",
+ "type" => "text/html",
+ "href" => profile_url
+ }
+ ]
+ })
+
+ %{url: ^profile_url} ->
+ {:ok, %Tesla.Env{status: 404}}
+ end)
+
+ assert {:error, _} = User.get_or_fetch(profile_url)
+ end
+
test "does not resolve profile URLs through an unverified WebFinger profile-page link" do
user = insert(:user)
profile_url = "https://social.example/@alice"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Aug 29, 12:34 AM (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1736732
Default Alt Text
(1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment