Skip to content

fix(inspect): limit request body size#761

Merged
vfusco merged 1 commit intonext/2.0from
feature/inspect-body-size-limit
Mar 17, 2026
Merged

fix(inspect): limit request body size#761
vfusco merged 1 commit intonext/2.0from
feature/inspect-body-size-limit

Conversation

@vfusco
Copy link
Collaborator

@vfusco vfusco commented Mar 16, 2026

No description provided.

@vfusco vfusco added this to the 2.0.0 milestone Mar 16, 2026
@vfusco vfusco self-assigned this Mar 16, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a 2 MiB request body size limit to the inspect endpoint, matching the Cartesi Machine's CMIO RX buffer size, to avoid reading oversized payloads into memory.

Changes:

  • Added maxPayloadSize constant and body-size enforcement using io.LimitReader in ServeHTTP
  • Added tests for payloads at and above the size limit
  • Extracted startServer helper in tests

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/inspect/inspect.go Limits request body reads to 2 MiB, returning 413 for oversized payloads
internal/inspect/inspect_test.go Adds tests for max and over-limit payloads; extracts startServer helper

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@github-project-automation github-project-automation bot moved this from Todo to Waiting Merge in Rollups SDK Mar 16, 2026
@vfusco vfusco merged commit ba86281 into next/2.0 Mar 17, 2026
12 checks passed
@vfusco vfusco deleted the feature/inspect-body-size-limit branch March 17, 2026 00:06
@github-project-automation github-project-automation bot moved this from Waiting Merge to Done in Rollups SDK Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants