diff options
author | 諏訪子 <suwako@076.moe> | 2025-05-26 09:58:50 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2025-05-27 10:13:13 +0900 |
commit | 30fc68008631269e90037be2310880d7e565a547 (patch) | |
tree | fdd5fccc7162f74fe0d98a47a404fafede701e63 | |
parent | ef0729f23e538dd81ff201e32597082c1a0ceea1 (diff) | |
download | nextcloud-server-30fc68008631269e90037be2310880d7e565a547.tar.gz nextcloud-server-30fc68008631269e90037be2310880d7e565a547.zip |
fix(settings): add link check in webfinger
Signed-off-by: 諏訪子 <suwako@076.moe>
-rw-r--r-- | lib/private/Accounts/AccountManager.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 57322620882..0922f802068 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -746,6 +746,23 @@ class AccountManager implements IAccountManager { if (!is_array($decoded) || ($decoded['subject'] ?? '') !== "acct:{$username}@{$instance}") { throw new InvalidArgumentException(); } + // check for activitypub link + if (is_array($decoded['links']) && isset($decoded['links'])) { + $found = false; + foreach ($decoded['links'] as $link) { + // have application/activity+json or application/ld+json + if (isset($link['type']) && ( + $link['type'] === 'application/activity+json' || + $link['type'] === 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' + )) { + $found = true; + break; + } + } + if (!$found) { + throw new InvalidArgumentException(); + } + } } catch (InvalidArgumentException) { throw new InvalidArgumentException(self::PROPERTY_FEDIVERSE); } catch (\Exception $error) { |