Conversation
The PATCH /session/:sessionId handler declared Body: SdpAnswer in its generic but omitted body from the Fastify schema object, so AJV skipped request-body validation entirely. Add body: SdpAnswer so malformed or oversized SDP answer payloads are rejected before reaching SDP handling. Closes #248
|
Automated code-reviewer verdict (daily-backlog-pr Phase 3): NEEDS CHANGES The functional fix is correct and minimal: Blocking
Suggestions
Moving issue #248 back to Ready for the test to be added.
|
daily-backlog-pr Phase 3 — automated review (verdict: LGTM)
Findings
|
Summary
PATCH /session/:sessionIddeclaredBody: SdpAnswerin its TypeScript generic but the Fastifyschemaobject omitted thebody:key, so AJV/Fastify performed no validation on the request body — any payload was accepted and passed straight to the SDP handling logic.This adds
body: SdpAnswerto the route schema so the body is validated (including the existingmaxLength: 65536bound onsdpAnswer) before processing. Defense-in-depth; no behavioral change for well-formed clients.Changes
src/api_productions.ts: addbody: SdpAnswerto thePATCH /session/:sessionIdschema.(
SdpAnswer.sdpAnswerinsrc/models.tsalready carriesmaxLength: 65536, so no model change was needed.)Test plan
npm run typecheck— cleannpm run lint— 0 errorsnpm test— 258/258 passCloses #248