Skip to content

Node.js based forum software built for the modern web

fix: block off access to Announce(anything but object) from non-cids

Julian Lamf7f071e3983a
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js
index 9b426eb881..845907d32c 100644
--- a/src/activitypub/inbox.js
+++ b/src/activitypub/inbox.js
@@ -534,6 +534,10 @@ inbox.announce = async (req) => {
switch(true) {
case object.type === 'Like': {
+ if (!cid) {
+ return;
+ }
+
const assertion = await activitypub.actors.assert(object.actor);
if (!assertion) {
throw new Error('[[error:activitypub.invalid-id]]');
@@ -555,12 +559,20 @@ inbox.announce = async (req) => {
}
case object.type === 'Update': {
+ if (!cid) {
+ return;
+ }
+
req.body = object;
await inbox.update(req);
break;
}
case object.type === 'Delete': {
+ if (!cid) {
+ return;
+ }
+
let id = object.object.id || object.object; // expecting object reference
const { id: localId } = await activitypub.helpers.resolveLocalId(id);
id = localId || id;
@@ -616,6 +628,10 @@ inbox.announce = async (req) => {
}
case object.type === 'Create': {
+ if (!cid) {
+ return;
+ }
+
object = object.object;
// falls through
}