Skip to content

Node.js based forum software built for the modern web

fix: sanity-check the id when mocking a post

Julian Lam5cbf3dd7eaaa
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.js
index 3ea4c03494..493655c272 100644
--- a/src/activitypub/mocks.js
+++ b/src/activitypub/mocks.js
@@ -155,7 +155,10 @@ Mocks.post = async (objects) => {
await activitypub.actors.assert(Array.from(actorIds));
const posts = await Promise.all(objects.map(async (object) => {
- if (!activitypub._constants.acceptedPostTypes.includes(object.type)) {
+ if (
+ !activitypub._constants.acceptedPostTypes.includes(object.type) ||
+ !activitypub.helpers.isUri(object.id) // sanity-check the id
+ ) {
return null;
}