mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5221] [Bug]: x-ui adds mkcp-legacy finalmask to inbounds #3658
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#3658
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?
Originally created by @femdiya on GitHub (Jun 12, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5221
Describe the bug
Before creating an inbound, simply switching once to mKCP mode will cause any client attached to that inbound to get a mkcp-legacy finalmask:
How to reproduce the problem
Expected behavior
x-ui shouldn't attach any unwanted strings to my client.
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.3.0
Xray-core version
26.6.1
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Xray config generation
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
No — direct access
Before submitting
@github-actions[bot] commented on GitHub (Jun 12, 2026):
The bug is confirmed in the source and is reproducible as described. The root cause is in
frontend/src/pages/inbounds/form/InboundFormModal.tsx, in theonNetworkChangefunction (around line 739).What happens
When the user switches the network selector to
kcp(mKCP),onNetworkChangeauto-seedsstreamSettings.finalmask.udpwith a{type: "mkcp-legacy", settings: {header: "", value: ""}}entry as a sensible default for mKCP traffic. This is intentional. However, when the user subsequently switches the network back to any other transport (e.g.,tcp/RAW), the function removes thekcpSettingskey from the form state but does not remove the auto-seededfinalmaskentry. The finalmask block is left behind.Why it survives to the wire payload and client exports
Two downstream guards both fail to remove it:
dropLegacyOptionalEmptiesinfrontend/src/lib/xray/inbound-form-adapter.ts(line ~289) prunes the entirefinalmaskblock only when all oftcp,udp, andquicParamsare empty. Because the staleudparray still has one entry,hasUdpistrueand the block is kept.hasShareableFinalMaskValueinfrontend/src/lib/xray/inbound-link.ts(line ~101) returnstruefor the entry because thetypefield ("mkcp-legacy") is a non-empty string. So thefmquery parameter is serialized into every client share link.The result is that the inbound is saved to the database with
finalmask.udp = [{type: "mkcp-legacy", settings: {header: "", value: ""}}]insidestreamSettingsregardless of the active transport, and every client export carries the orphaned mask.Workaround until a fix ships
After saving the affected inbound, open the Advanced → Stream editor in the panel, locate the
finalmaskkey in the JSON, and either delete the entirefinalmaskblock or clear itsudparray:Save the inbound again. Clients generated after that will no longer carry the stale
mkcp-legacymask.Expected fix
The
onNetworkChangehandler should clear (or omit) thefinalmask.udpmkcp-legacyentry it auto-seeded whenever the network changes away fromkcp. The simplest approach is to strip anymkcp-legacyentries fromfinalmask.udpin the else-branch of theif (next === 'kcp')block.This reply was generated automatically; a maintainer may follow up.