feat(core): Upgrade to express 5 to address CVE-2024-52798 (#14332)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-03 13:43:52 +02:00
committed by GitHub
parent 02d11b5e7a
commit 4110f3188e
22 changed files with 465 additions and 327 deletions

View File

@@ -114,14 +114,17 @@ export abstract class AbstractServer {
private async setupHealthCheck() {
// main health check should not care about DB connections
this.app.get('/healthz', async (_req, res) => {
this.app.get('/healthz', (_req, res) => {
res.send({ status: 'ok' });
});
this.app.get('/healthz/readiness', async (_req, res) => {
return Db.connectionState.connected && Db.connectionState.migrated
? res.status(200).send({ status: 'ok' })
: res.status(503).send({ status: 'error' });
this.app.get('/healthz/readiness', (_req, res) => {
const { connected, migrated } = Db.connectionState;
if (connected && migrated) {
res.status(200).send({ status: 'ok' });
} else {
res.status(503).send({ status: 'error' });
}
});
const { connectionState } = Db;
@@ -183,20 +186,20 @@ export abstract class AbstractServer {
if (this.webhooksEnabled) {
const liveWebhooksRequestHandler = createWebhookHandlerFor(Container.get(LiveWebhooks));
// Register a handler for live forms
this.app.all(`/${this.endpointForm}/:path(*)`, liveWebhooksRequestHandler);
this.app.all(`/${this.endpointForm}/*path`, liveWebhooksRequestHandler);
// Register a handler for live webhooks
this.app.all(`/${this.endpointWebhook}/:path(*)`, liveWebhooksRequestHandler);
this.app.all(`/${this.endpointWebhook}/*path`, liveWebhooksRequestHandler);
// Register a handler for waiting forms
this.app.all(
`/${this.endpointFormWaiting}/:path/:suffix?`,
`/${this.endpointFormWaiting}/:path/{:suffix}`,
createWebhookHandlerFor(Container.get(WaitingForms)),
);
// Register a handler for waiting webhooks
this.app.all(
`/${this.endpointWebhookWaiting}/:path/:suffix?`,
`/${this.endpointWebhookWaiting}/:path/{:suffix}`,
createWebhookHandlerFor(Container.get(WaitingWebhooks)),
);
}
@@ -205,8 +208,8 @@ export abstract class AbstractServer {
const testWebhooksRequestHandler = createWebhookHandlerFor(Container.get(TestWebhooks));
// Register a handler
this.app.all(`/${this.endpointFormTest}/:path(*)`, testWebhooksRequestHandler);
this.app.all(`/${this.endpointWebhookTest}/:path(*)`, testWebhooksRequestHandler);
this.app.all(`/${this.endpointFormTest}/*path`, testWebhooksRequestHandler);
this.app.all(`/${this.endpointWebhookTest}/*path`, testWebhooksRequestHandler);
}
// Block bots from scanning the application