Bound inbound request bodies and redact rejected input #327

Closed
opened 2026-08-08 18:31:11 +00:00 by rockachopa · 0 comments
Member

Problem

The public sign-in route accepts an unbounded HTTP body before Pydantic validation and source throttling. FastAPI validation responses also reflect rejected input, including access-token canaries. A 2 MiB anonymous request currently returns a similarly sized 422 and bypasses the sign-in attempt budget.

Slice

  • Reject declared and streamed oversized JSON bodies before parsing.
  • Apply a tight sign-in cap and a documented API mutation cap.
  • Return compact no-store 413 responses with the existing browser security boundary.
  • Redact submitted input and validation context from 422 responses.

Acceptance

  • Oversized POST /api/v1/session with or without Content-Length returns compact 413 before endpoint/throttle work.
  • A unique invalid-token canary is absent from 422 responses.
  • Normal maximum-valid mutations remain accepted.
  • Focused and full suites pass.

Non-duplication

No historical issue/PR title or recent commit covers inbound body admission, HTTP 413, streamed request limiting, or validation-input redaction. #270 throttles credential comparisons only after validation; #295 adds outbound browser headers; #246 bounds outbound Gitea transport.

## Problem The public sign-in route accepts an unbounded HTTP body before Pydantic validation and source throttling. FastAPI validation responses also reflect rejected `input`, including access-token canaries. A 2 MiB anonymous request currently returns a similarly sized 422 and bypasses the sign-in attempt budget. ## Slice - Reject declared and streamed oversized JSON bodies before parsing. - Apply a tight sign-in cap and a documented API mutation cap. - Return compact no-store 413 responses with the existing browser security boundary. - Redact submitted input and validation context from 422 responses. ## Acceptance - Oversized `POST /api/v1/session` with or without Content-Length returns compact 413 before endpoint/throttle work. - A unique invalid-token canary is absent from 422 responses. - Normal maximum-valid mutations remain accepted. - Focused and full suites pass. ## Non-duplication No historical issue/PR title or recent commit covers inbound body admission, HTTP 413, streamed request limiting, or validation-input redaction. #270 throttles credential comparisons only after validation; #295 adds outbound browser headers; #246 bounds outbound Gitea transport.
timmy was assigned by rockachopa 2026-08-08 18:31:11 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#327
No description provided.