summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/ServerService.ts
diff options
context:
space:
mode:
authorMar0xy <marie@kaifa.ch>2023-11-22 23:40:27 +0100
committerMar0xy <marie@kaifa.ch>2023-11-22 23:40:27 +0100
commit42bf8e5e76fb6a6dce804c1784e1e2833268c1e6 (patch)
tree9f82e50010bf1fc287e98ab856ab12857f33d0b0 /packages/backend/src/server/ServerService.ts
parentfix: attachments not working on FB import (diff)
parent2023.11.1 (diff)
downloadsharkey-42bf8e5e76fb6a6dce804c1784e1e2833268c1e6.tar.gz
sharkey-42bf8e5e76fb6a6dce804c1784e1e2833268c1e6.tar.bz2
sharkey-42bf8e5e76fb6a6dce804c1784e1e2833268c1e6.zip
merge: upstream
Diffstat (limited to 'packages/backend/src/server/ServerService.ts')
-rw-r--r--packages/backend/src/server/ServerService.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/backend/src/server/ServerService.ts b/packages/backend/src/server/ServerService.ts
index 16bcfc7459..4d10e0fa4f 100644
--- a/packages/backend/src/server/ServerService.ts
+++ b/packages/backend/src/server/ServerService.ts
@@ -9,6 +9,7 @@ import { fileURLToPath } from 'node:url';
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
import Fastify, { FastifyInstance } from 'fastify';
import fastifyStatic from '@fastify/static';
+import fastifyRawBody from 'fastify-raw-body';
import { IsNull } from 'typeorm';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import type { Config } from '@/config.js';
@@ -88,6 +89,13 @@ export class ServerService implements OnApplicationShutdown {
});
}
+ // Register raw-body parser for ActivityPub HTTP signature validation.
+ await fastify.register(fastifyRawBody, {
+ global: false,
+ encoding: null,
+ runFirst: true,
+ });
+
// Register non-serving static server so that the child services can use reply.sendFile.
// `root` here is just a placeholder and each call must use its own `rootPath`.
fastify.register(fastifyStatic, {