mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5861] [MERGED] fix(inbound): reject finalmask + REALITY combo (crashes Xray-core) #6011
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#6011
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/5861
Author: @mrnickson-hue
Created: 7/8/2026
Status: ✅ Merged
Merged: 7/8/2026
Merged by: @MHSanaei
Base:
main← Head:fix/reject-finalmask-reality-combo📝 Commits (2)
13f1d6cfix(inbound): reject finalmask configured together with REALITY security6f962bafix(inbound): heal legacy rows and narrow the finalmask+REALITY guard📊 Changes
3 files changed (+219 additions, -0 deletions)
View changed files
📝
internal/web/service/inbound.go(+50 -0)➕
internal/web/service/inbound_finalmask_reality_test.go(+157 -0)📝
internal/web/service/xray.go(+12 -0)📄 Description
Summary
Configuring
finalmaskon an inbound withsecurity: realitycurrently crashes the entire Xray-core process on the first connection — not just that connection. Reproduced live on a clean build from source (v26.6.27):Root cause:
finalmaskwraps the listener/connection before REALITY's handshake ever sees it (TcpmaskManager.WrapListener→WrapConnServerruns atAccept()time, ahead ofreality.Server()).reality.Server()then does an unchecked type assertion assuming the connection is always a raw*net.TCPConn. With finalmask in front, it's a*fragment.fragmentConninstead, and the assertion panics.Filed upstream with full repro + trace: https://github.com/XTLS/Xray-core/issues/6453
RPRX (Xray-core/REALITY author) responded and closed it — the plan upstream is to document this combination as unsupported rather than make the failure mode graceful. Since the crash itself won't be fixed at the engine level, the panel needs to stop this configuration from being saved in the first place.
Change
AddInbound/UpdateInboundnow rejectstreamSettingswithsecurity: realityand a non-emptyfinalmask.tcp/finalmask.udpwith a clear error, instead of letting it reach Xray and crash the process.Test plan
go build ./internal/web/service/...TestValidateFinalMaskRealityCombo— 6 cases (empty streamSettings, reality without finalmask, reality with empty finalmask arrays, reality+tcp fragment, reality+udp mask, non-reality security+finalmask)go test ./internal/web/service/— all passing, no regressionsRelated: #5857 (originally reported as an xHTTP-specific connection failure; root cause turned out to be this panic, not xHTTP-specific — reproduces on plain
tcptransport too)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.