Skip to content

feat(api): BA-117 add bounded request body size and reject oversized JSON payloads - #1041

Open
ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/request-body-size-1030
Open

ranjeetprabhatedu-dotcom wants to merge 1 commit into
BlockDash-Studios:mainfrom
ranjeetprabhatedu-dotcom:feat/request-body-size-1030

Conversation

@ranjeetprabhatedu-dotcom

Copy link
Copy Markdown

Summary

This PR implements BA-117 to add a bounded request body size, preventing denial-of-service and memory exhaustion via oversized payloads.

  • Configures express json({ limit }) and urlencoded({ limit }) body parsers in main.ts with configurable MAX_BODY_SIZE (defaulting safely to 1mb).
  • Exports REQUEST_BODY_LIMIT provider in AppModule so the limit is recognized across all application contexts.
  • Adds comprehensive unit tests in app.controller.spec.ts verifying that payloads exceeding the configured body threshold are rejected with HTTP 413 entity.too.large, while normal valid payloads parse successfully.
  • Scoped strictly to the 3 allowlisted files:
    • BackendAcademy/src/main.ts
    • BackendAcademy/src/app.module.ts
    • BackendAcademy/src/app.controller.spec.ts

Closes #1030

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.

BA-117 — Add a bounded request body size

1 participant