Skip to content

fix(security): declare 204 response schema on PATCH /session - #295

Open
birme wants to merge 1 commit into
mainfrom
bug-fixer/289-patch-session-204-schema
Open

fix(security): declare 204 response schema on PATCH /session#295
birme wants to merge 1 commit into
mainfrom
bug-fixer/289-patch-session-204-schema

Conversation

@birme

@birme birme commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The PATCH /session/:sessionId handler sends reply.code(204).send() on success, but the TypeBox response schema only declared 200: Type.String(). Because 204 was undeclared, Fastify applied the wrong serializer and skipped response validation for the success path (a validation bypass).
  • Replaced the incorrect 200: Type.String() entry with 204: Type.Null(), keeping the existing 400/500 entries. Minimal one-line schema change.
  • Added a regression test asserting PATCH /session/:sessionId returns 204 with an empty body on success (backend tests mock ./log).

Test plan

  • Tests pass (npm test) — 244 passed
  • TypeScript compiles (npm run typecheck)
  • Lint clean (npm run lint) — 0 errors
  • PATCH /session returns 204 and is now schema-validated

Closes #289

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: PATCH /session response schema declares 200 but handler sends 204 — validation bypass

2 participants