Skip to content

Commit 30fc680

Browse files
fix(settings): add link check in webfinger
Signed-off-by: 諏訪子 <[email protected]>
1 parent ef0729f commit 30fc680

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/private/Accounts/AccountManager.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,23 @@ private function sanitizePropertyFediverse(IAccountProperty $property): void {
746746
if (!is_array($decoded) || ($decoded['subject'] ?? '') !== "acct:{$username}@{$instance}") {
747747
throw new InvalidArgumentException();
748748
}
749+
// check for activitypub link
750+
if (is_array($decoded['links']) && isset($decoded['links'])) {
751+
$found = false;
752+
foreach ($decoded['links'] as $link) {
753+
// have application/activity+json or application/ld+json
754+
if (isset($link['type']) && (
755+
$link['type'] === 'application/activity+json' ||
756+
$link['type'] === 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
757+
)) {
758+
$found = true;
759+
break;
760+
}
761+
}
762+
if (!$found) {
763+
throw new InvalidArgumentException();
764+
}
765+
}
749766
} catch (InvalidArgumentException) {
750767
throw new InvalidArgumentException(self::PROPERTY_FEDIVERSE);
751768
} catch (\Exception $error) {

0 commit comments

Comments
 (0)