Skip to content

Commit 9acdda0

Browse files
committed
fix github webhook signature validation for form-encoded requests
1 parent 910f427 commit 9acdda0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mimir-rag/src/server/server.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ export async function createServer(options: ServerOptions = {}): Promise<{ app:
4949
const logger = getLogger();
5050

5151
const app = express();
52-
app.use(
53-
express.json({
54-
verify: (req, _res, buf) => {
55-
(req as RequestWithRawBody).rawBody = Buffer.from(buf);
56-
},
57-
})
58-
);
52+
53+
const verifyRawBody = (req: any, _res: any, buf: Buffer) => {
54+
(req as RequestWithRawBody).rawBody = Buffer.from(buf);
55+
};
56+
57+
app.use(express.json({ verify: verifyRawBody }));
58+
app.use(express.urlencoded({ extended: true, verify: verifyRawBody }));
5959
app.use(applyCors);
6060

6161
// Apply API key middleware to all routes except /mcp/*, /webhook/*, and /health endpoints

0 commit comments

Comments
 (0)