diff --git a/src/api_validation.test.ts b/src/api_validation.test.ts index d0120de..6af7811 100644 --- a/src/api_validation.test.ts +++ b/src/api_validation.test.ts @@ -391,6 +391,19 @@ describe('Input Validation', () => { expect(response.statusCode).toBe(400); }); + test('rejects lineId exceeding 200 characters', async () => { + const response = await server.inject({ + method: 'POST', + url: '/api/v1/session', + body: { + productionId: '1', + lineId: 'x'.repeat(201), + username: 'user' + } + }); + expect(response.statusCode).toBe(400); + }); + test('rejects username exceeding 200 characters', async () => { const response = await server.inject({ method: 'POST', diff --git a/src/models.ts b/src/models.ts index b38f1ea..062f6e4 100644 --- a/src/models.ts +++ b/src/models.ts @@ -306,7 +306,7 @@ export const DetailedProductionResponse = Type.Object({ export const NewSession = Type.Object({ productionId: Type.String({ minLength: 1, pattern: '^[0-9]+$' }), - lineId: Type.String({ minLength: 1 }), + lineId: Type.String({ minLength: 1, maxLength: 200 }), username: Type.String({ minLength: 1, maxLength: 200 }) }); @@ -316,7 +316,7 @@ export const SessionResponse = Type.Object({ }); export const SdpAnswer = Type.Object({ - sdpAnswer: Type.String() + sdpAnswer: Type.String({ maxLength: 65536 }) }); export const ErrorResponse = Type.Object({