mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5243] [CLOSED] feat(web): cap request body size on state-changing routes #5826
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5826
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5243
Author: @n0ctal
Created: 6/12/2026
Status: ❌ Closed
Base:
main← Head:claude-pr-0008-request-body-limit📝 Commits (1)
4c0824efeat(web): cap request body size on state-changing routes📊 Changes
3 files changed (+86 additions, -0 deletions)
View changed files
➕
internal/web/middleware/bodylimit.go(+30 -0)➕
internal/web/middleware/bodylimit_test.go(+49 -0)📝
internal/web/web.go(+7 -0)📄 Description
Summary
This PR adds a request body size limit for state-changing routes.
It uses
http.MaxBytesReaderto reject oversized request bodies before they cause unnecessary memory allocation or long processing on mutation endpoints.Why
Even with authentication in place, large request bodies on create/update/import-style routes are an avoidable resource risk. A reasonable cap improves resilience against buggy clients and accidental oversized submissions.
Scope
Validation
Risk
Low. This is defensive hardening and does not alter normal successful request flows.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.