Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/admin-api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ if (cloudflareAccessMiddleware) {
app.use(httpLogger);
app.use(requestContextMiddleware);
app.use(cookieParser());
app.use(express.json({ limit: '1mb' }));
app.use(express.json({ limit: '1mb', inflate: false }));

app.use('/auth', authRoutes);
app.use('/api', apiRoutes);
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/routes/csp-report.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function toOriginAndPath(value: unknown): string | undefined {
routes.post(
'/',
cspReportRateLimit,
json({ type: ['application/csp-report', 'application/reports+json', 'application/json'], limit: '100kb' }),
json({ type: ['application/csp-report', 'application/reports+json', 'application/json'], limit: '100kb', inflate: false }),
(req: express.Request, res: express.Response) => {
try {
const body = req.body;
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/app/routes/webhook.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const webhookRateLimit = createRateLimit('webhook', {
keyGenerator: rateLimitGetKeyGenerator(),
});

routes.use(raw({ type: 'application/json' }));
routes.use(raw({ type: 'application/json', inflate: false }));

routes.post('/stripe', webhookRateLimit, billingController.webhook.controllerFn());
routes.post('/mailgun', webhookRateLimit, mailgunWebhookController.webhook.controllerFn());
Expand Down
10 changes: 6 additions & 4 deletions apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,12 @@ if (ENV.NODE_ENV === 'production' && !ENV.CI && cluster.isPrimary) {
// handles the report payload instead of the 20mb global JSON parser, and responds 204.
app.use('/api/csp-report', cspReportRoutes);

app.use(raw({ limit: '30mb', type: ['text/csv'] }));
app.use(raw({ limit: '30mb', type: ['application/zip'] }));
app.use(json({ limit: '20mb', type: ['json'] }));
app.use(urlencoded({ extended: true }));
// inflate: false - no client sends compressed request bodies; rejecting Content-Encoding (415) keeps
// untrusted input away from zlib/brotli decoders (e.g. CVE-2026-111497)
app.use(raw({ limit: '30mb', type: ['text/csv'], inflate: false }));
app.use(raw({ limit: '30mb', type: ['application/zip'], inflate: false }));
app.use(json({ limit: '20mb', type: ['json'], inflate: false }));
app.use(urlencoded({ extended: true, inflate: false }));

// Must run after sessionMiddleware (which loads req.session) and before any route handler,
// so an expired pending-verification session is destroyed before a route can observe it.
Expand Down
4 changes: 2 additions & 2 deletions apps/geo-ip-api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ if (ENV.ENVIRONMENT !== 'development' && (!ENV.GEO_IP_API_USERNAME || !ENV.GEO_I

const app = express();

app.use(json({ limit: '20mb' }));
app.use(urlencoded({ extended: true }));
app.use(json({ limit: '20mb', inflate: false }));
app.use(urlencoded({ extended: true, inflate: false }));
app.use(httpLogger);
app.use(requestContextMiddleware);

Expand Down
Loading