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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ and this project adheres to
- 🐛(frontend) fix broadcast store sync #1846
- 🐛(helm) use celery resources instead of backend resources
- 🐛(helm) reverse liveness and readiness for backend deployment
- 🐛(y-provider) use CONVERSION_FILE_MAX_SIZE settings #1913

## [v4.5.0] - 2026-01-28

Expand Down
2 changes: 1 addition & 1 deletion src/backend/impress/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ class Base(Configuration):

# Imported file settings
CONVERSION_FILE_MAX_SIZE = values.IntegerValue(
20 * MB, # 10MB
20 * MB,
environ_name="CONVERSION_FILE_MAX_SIZE",
environ_prefix=None,
)
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/servers/y-provider/__tests__/server.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ vi.mock('../src/env', async (importOriginal) => {
...(await importOriginal()),
COLLABORATION_SERVER_ORIGIN: 'http://localhost:3000',
Y_PROVIDER_API_KEY: 'yprovider-api-key',
CONVERSION_FILE_MAX_SIZE: 500 * 1024, // 500kb
};
});

Expand Down Expand Up @@ -54,7 +55,7 @@ describe('Server Tests', () => {
expect(response.status).not.toBe(413);
});

it('rejects payloads larger than 500kb for the CONVERT route', async () => {
it('rejects payloads larger than CONVERSION_FILE_MAX_SIZE for the CONVERT route', async () => {
const app = initApp();

const oversizedPayload = 'a'.repeat(501 * 1024); // 501kb payload
Expand Down
3 changes: 3 additions & 0 deletions src/frontend/servers/y-provider/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export const COLLABORATION_SERVER_SECRET = process.env
.COLLABORATION_SERVER_SECRET_FILE
? readFileSync(process.env.COLLABORATION_SERVER_SECRET_FILE, 'utf-8')
: process.env.COLLABORATION_SERVER_SECRET || 'secret-api-key';
export const CONVERSION_FILE_MAX_SIZE = process.env.CONVERSION_FILE_MAX_SIZE
? Number(process.env.CONVERSION_FILE_MAX_SIZE)
: 20971520; // 20 MB default
export const Y_PROVIDER_API_KEY = process.env.Y_PROVIDER_API_KEY_FILE
? readFileSync(process.env.Y_PROVIDER_API_KEY_FILE, 'utf-8')
: process.env.Y_PROVIDER_API_KEY || 'yprovider-api-key';
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/servers/y-provider/src/servers/appServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as Sentry from '@sentry/node';
import express from 'express';
import expressWebsockets from 'express-ws';

import { CONVERSION_FILE_MAX_SIZE } from '@/env';
import {
collaborationResetConnectionsHandler,
collaborationWSHandler,
Expand Down Expand Up @@ -55,7 +56,7 @@ export const initApp = () => {
routes.CONVERT,
httpSecurity,
express.raw({
limit: '500kb',
limit: CONVERSION_FILE_MAX_SIZE,
type: '*/*',
}),
convertHandler,
Expand Down
Loading