[PR #5493] [MERGED] fix(subscription): bound outbound subscription response body #5901

Closed
opened 2026-11-02 04:04:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5493
Author: @n0ctal
Created: 6/22/2026
Status: ✅ Merged
Merged: 6/23/2026
Merged by: @MHSanaei

Base: main ← Head: pr-0013-bound-outbound-sub


📝 Commits (1)

  • f1de820 fix(subscription): bound outbound response body

📊 Changes

2 files changed (+46 additions, -1 deletions)

View changed files

📝 internal/web/service/outbound_subscription.go (+20 -1)
📝 internal/web/service/outbound_subscription_test.go (+26 -0)

📄 Description

The outbound subscription handler reads the upstream response fully into memory before serving it. A large or slow upstream (or a malicious one) can therefore grow panel memory without bound.

This wraps the read in an io.LimitReader with an explicit cap and returns a clear error when the response exceeds it, mirroring the request-body bounding already applied to state-changing routes. Behavior is unchanged for normal-sized responses.

Adds a focused test for the overflow and under-limit paths.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5493 **Author:** [@n0ctal](https://github.com/n0ctal) **Created:** 6/22/2026 **Status:** ✅ Merged **Merged:** 6/23/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `pr-0013-bound-outbound-sub` --- ### 📝 Commits (1) - [`f1de820`](https://github.com/MHSanaei/3x-ui/commit/f1de8207093537480610aa3aa2f88e6864ec8ba8) fix(subscription): bound outbound response body ### 📊 Changes **2 files changed** (+46 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/outbound_subscription.go` (+20 -1) 📝 `internal/web/service/outbound_subscription_test.go` (+26 -0) </details> ### 📄 Description The outbound subscription handler reads the upstream response fully into memory before serving it. A large or slow upstream (or a malicious one) can therefore grow panel memory without bound. This wraps the read in an `io.LimitReader` with an explicit cap and returns a clear error when the response exceeds it, mirroring the request-body bounding already applied to state-changing routes. Behavior is unchanged for normal-sized responses. Adds a focused test for the overflow and under-limit paths. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:04:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5901
No description provided.