mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(settings): add link check in webfinger
Signed-off-by: 諏訪子 <suwako@076.moe>
This commit is contained in:
parent
3817a4b445
commit
1a2f69e0e7
1 changed files with 17 additions and 0 deletions
|
|
@ -741,6 +741,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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue