inboxRouter.post('/inbox',
signatureValidator,
asyncMiddleware(checkSignature),
- activityPubValidator,
+ asyncMiddleware(activityPubValidator),
asyncMiddleware(inboxController)
)
signatureValidator,
asyncMiddleware(checkSignature),
localAccountValidator,
- activityPubValidator,
+ asyncMiddleware(activityPubValidator),
asyncMiddleware(inboxController)
)
+import { logger } from '../../helpers/logger'
+import { getServerActor } from '../../helpers/utils'
import { ActorModel } from '../../models/activitypub/actor'
import { JobQueue } from '../job-queue'
async function addFetchOutboxJob (actor: ActorModel) {
+ // Don't fetch ourselves
+ const serverActor = await getServerActor()
+ if (serverActor.id === actor.id) {
+ logger.error('Cannot fetch our own outbox!')
+ return
+ }
+
const payload = {
uris: [ actor.outboxUrl ]
}
import { body } from 'express-validator/check'
import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
import { logger } from '../../../helpers/logger'
+import { getServerActor } from '../../../helpers/utils'
+import { ActorModel } from '../../../models/activitypub/actor'
import { areValidationErrors } from '../utils'
const activityPubValidator = [
body('').custom((value, { req }) => isRootActivityValid(req.body)),
- (req: express.Request, res: express.Response, next: express.NextFunction) => {
+ async (req: express.Request, res: express.Response, next: express.NextFunction) => {
logger.debug('Checking activity pub parameters')
if (areValidationErrors(req, res)) return
+ const serverActor = await getServerActor()
+ const remoteActor = res.locals.signature.actor as ActorModel
+ if (serverActor.id === remoteActor.id) {
+ logger.error('Receiving request in INBOX by ourselves!', req.body)
+ return res.sendStatus(409)
+ }
+
return next()
}
]