fix: add privilege check to user follows

This commit is contained in:
Julian Lam
2024-07-24 11:59:50 -04:00
parent 7bf349b62b
commit 399d41030f

View File

@@ -287,8 +287,11 @@ inbox.follow = async (req) => {
const handle = await user.getUserField(actor, 'username'); const handle = await user.getUserField(actor, 'username');
if (type === 'user') { if (type === 'user') {
const exists = await user.exists(id); const [exists, allowed] = await Promise.all([
if (!exists) { user.exists(id),
privileges.global.can('view:users', activitypub._constants.uid),
]);
if (!exists || !allowed) {
throw new Error('[[error:invalid-uid]]'); throw new Error('[[error:invalid-uid]]');
} }