Skip to content

fix(app-server): enforce body limit on actual bytes#360

Open
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:codex/fix-body-limit-actual-bytes
Open

fix(app-server): enforce body limit on actual bytes#360
OnlyYu1996 wants to merge 1 commit into
CortexLM:mainfrom
OnlyYu1996:codex/fix-body-limit-actual-bytes

Conversation

@OnlyYu1996
Copy link
Copy Markdown

Summary

  • Read request bodies through axum's byte limiter before forwarding to handlers.
  • Return 413 when the streamed body exceeds max_body_size, even without a Content-Length header.
  • Rebuild the request with the bounded body so downstream handlers keep their existing extraction behavior.
  • Add regression coverage for streaming bodies with no Content-Length, both under and over the configured limit.

Fixes PlatformNetwork/bounty-challenge#53239

Verification

  • cargo fmt --package cortex-app-server --check
  • cargo test --package cortex-app-server body_limit -- --nocapture
  • cargo test --package cortex-app-server middleware::tests -- --nocapture
  • cargo check --package cortex-app-server --lib
  • git diff --check

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant