]> cat aescling's git repositories - mastodon.git/commitdiff
Check Webfinger-returned author URI even when not redirected (#5213)
authorThibG <thib@sitedethib.com>
Wed, 4 Oct 2017 07:59:28 +0000 (09:59 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 4 Oct 2017 07:59:28 +0000 (09:59 +0200)
The whole point of verified_webfinger? is to check the WebFinger-discoverable
URI maps back to the known author URI. This was not actually verified if the
first Webfinger request was not a redirection.

app/services/activitypub/fetch_remote_account_service.rb

index e6c6338be5be857a7426356234099f3a9b182ce1..d6ba625a9a467929d83d4049a280900e1372c57b 100644 (file)
@@ -31,7 +31,7 @@ class ActivityPub::FetchRemoteAccountService < BaseService
     webfinger                            = Goldfinger.finger("acct:#{@username}@#{@domain}")
     confirmed_username, confirmed_domain = split_acct(webfinger.subject)
 
-    return true if @username.casecmp(confirmed_username).zero? && @domain.casecmp(confirmed_domain).zero?
+    return webfinger.link('self')&.href == @uri if @username.casecmp(confirmed_username).zero? && @domain.casecmp(confirmed_domain).zero?
 
     webfinger                            = Goldfinger.finger("acct:#{confirmed_username}@#{confirmed_domain}")
     @username, @domain                   = split_acct(webfinger.subject)