mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #12707 ensure actor matches context attributedTo
This commit is contained in:
@@ -77,7 +77,7 @@ inbox.create = async (req) => {
|
||||
};
|
||||
|
||||
inbox.add = async (req) => {
|
||||
const { object, target } = req.body;
|
||||
const { actor, object, target } = req.body;
|
||||
|
||||
// Only react on Adds pertaining to local posts
|
||||
const { type, id: pid } = await activitypub.helpers.resolveLocalId(object);
|
||||
@@ -85,9 +85,13 @@ inbox.add = async (req) => {
|
||||
// Check context of OP
|
||||
const tid = await posts.getPostField(pid, 'tid');
|
||||
const context = await topics.getTopicField(tid, 'context');
|
||||
if (context && context === target) {
|
||||
activitypub.helpers.log(`[activitypub/inbox/add] Associating pid ${pid} with new context ${target}`);
|
||||
await posts.setPostField(pid, 'context', target);
|
||||
console.log(context);
|
||||
if (context) {
|
||||
const { attributedTo } = await activitypub.get('uid', 0, context);
|
||||
if (context === target && attributedTo === actor) {
|
||||
activitypub.helpers.log(`[activitypub/inbox/add] Associating pid ${pid} with new context ${target}`);
|
||||
await posts.setPostField(pid, 'context', target);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user