Skip to content

feat: add global request body size limit middleware with 413 handling#189

Merged
Sulex45 merged 1 commit into
stellarkit-lab-devtools:mainfrom
whitezaddy:feat/request-size-limiter
May 29, 2026
Merged

feat: add global request body size limit middleware with 413 handling#189
Sulex45 merged 1 commit into
stellarkit-lab-devtools:mainfrom
whitezaddy:feat/request-size-limiter

Conversation

@whitezaddy
Copy link
Copy Markdown
Contributor

closes #60

Branch Description

Implemented a global request body size limiter for the StellarKit API to protect against oversized JSON payload attacks.

Key Changes

  • Added bodySizeLimit.js

    • Uses express.json({ limit })
    • Configurable via MAX_BODY_SIZE
    • Defaults to 10kb
  • Updated index.js

    • Registered bodySizeLimit middleware globally before route handling
  • Updated errorHandler.js

    • Returns 413 Payload Too Large for oversized request bodies
    • Uses structured JSON error with type: "PayloadTooLargeError"
  • Added bodySizeLimit.test.js

    • Verifies oversized JSON payloads return 413
    • Verifies MAX_BODY_SIZE override behavior

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@whitezaddy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Sulex45 Sulex45 merged commit 8f76272 into stellarkit-lab-devtools:main May 29, 2026
1 of 3 checks passed
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.

Add request body size limit middleware

2 participants