fix(cloud): harden edge gateways, api-server ssrf, supabase fail-closed quota, and web/admin lifecycle

This commit is contained in:
Yun Chan 2026-11-14 15:10:32 +09:00
parent 2a009e421a
commit c68e81e0aa
46 changed files with 2553 additions and 294 deletions

View file

@ -259,3 +259,30 @@ Deno.test('non-multipart body fails closed with 400 instead of 500', async () =>
assertEquals(await response.json(), { error: 'invalid_multipart_body' }, 'body')
assertEquals(h.events, [], 'no quota or provider work')
})
Deno.test('sttProxy_초과ContentLength헤더_본문파싱전에413으로차단한다', async () => {
const h = harness([fakeProvider('groq', OK)])
let bodyRead = false
const req = new Request('http://localhost/stt-proxy', {
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data; boundary=x',
'Content-Length': String(30 * 1024 * 1024),
},
body: new ReadableStream(
{
pull() {
bodyRead = true
return Promise.reject(new Error('body must not be read when Content-Length exceeds cap'))
},
},
new CountQueuingStrategy({ highWaterMark: 0 }),
),
})
const response = await h.handler(req)
assertEquals(response.status, 413, 'oversized Content-Length returns 413')
assertEquals(await response.json(), { error: 'audio_too_large' }, 'fixed size error code')
assertEquals(bodyRead, false, 'request stream must not be pulled')
assertEquals(req.bodyUsed, false, 'request body must remain unread')
assertEquals(h.events, [], 'no quota or provider work')
})