Skip to content

Node.js based forum software built for the modern web

fix: #14185, assert note if Like received to a post that doesn't already exist

Julian Lam48bf54b948b0
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js
index 374ad3da1c..2a52a96903 100644
--- a/src/activitypub/inbox.js
+++ b/src/activitypub/inbox.js
@@ -338,9 +338,16 @@ inbox.like = async (req) => {
exists = await posts.exists(_id);
id = _id;
}
-
} else {
exists = await posts.exists(object.id);
+ if (!exists) {
+ // Proactively pull in the note
+ const asserted = await activitypub.notes.assert(0, object.id, { skipChecks: 1 });
+ if (!asserted) {
+ throw new Error('[[error:invalid-pid]]');
+ }
+ exists = true;
+ }
id = object.id;
}
if (!id || !exists) {