mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #7003] [MERGED] fix(inbounds): reject incompatible VLESS fallbacks and prevent Xray crashes #6571
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#6571
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/7003
Author: @HamedSanaei
Created: 10/28/2026
Status: ✅ Merged
Merged: 11/3/2026
Merged by: @MHSanaei
Base:
main← Head:fix/vlessenc-fallbacks-xray-crash-7001📝 Commits (2)
eaa4359fix(inbounds): prevent VLESS fallback conflicts from crashing Xray75954bcMerge remote-tracking branch 'origin/main' into pr/7003📊 Changes
31 files changed (+853 additions, -79 deletions)
View changed files
📝
.github/workflows/ci.yml(+3 -3)📝
docs/content/docs/en/reference/api/inbounds.mdx(+30 -16)📝
docs/public/openapi.json(+6 -8)📝
frontend/public/openapi.json(+6 -8)📝
frontend/src/pages/api-docs/endpoints.ts(+5 -5)📝
frontend/src/pages/inbounds/form/FallbacksCard.tsx(+6 -1)📝
frontend/src/pages/inbounds/form/InboundFormModal.tsx(+56 -9)📝
frontend/src/pages/inbounds/form/useInboundFallbacks.ts(+10 -0)📝
frontend/src/test/inbound-form-modal.test.tsx(+132 -10)📝
frontend/src/test/setup.components.ts(+4 -1)➕
internal/web/controller/inbound_vless_fallback_test.go(+119 -0)📝
internal/web/service/fallback.go(+10 -2)📝
internal/web/service/inbound.go(+17 -2)📝
internal/web/service/inbound_protocol.go(+3 -0)➕
internal/web/service/inbound_vless_fallback.go(+78 -0)➕
internal/web/service/inbound_vless_fallback_test.go(+317 -0)📝
internal/web/service/xray.go(+9 -0)📝
internal/web/translation/ar-EG.json(+3 -1)📝
internal/web/translation/en-US.json(+3 -1)📝
internal/web/translation/es-ES.json(+3 -1)...and 11 more files
📄 Description
Problem
API and JSON import accept VLESS fallbacks with active server decryption. Xray rejects even
fallbacks: [], so restarting with the saved configuration can take every inbound down. Panel-managed fallback injection can recreate the conflict.Root cause
Xray checks server-side
decryptionand whether the fallback slice is nil. UI-only removal of empty arrays did not protect API/import requests, and managed fallback eligibility ignored decryption. The existingencryptionfield is for link generation and is deliberately not used for this restriction.Solution
Testing
Validation ran in an isolated Linux checkout of the proposed files with Go 1.27.3, Node 26.12.1, npm 11.20.0 and Chromium. No production installation or live client traffic was used.
make verifygo test ./internal/web/service/... ./internal/web/controller/... ./internal/xray/... -count=1make raceXRAY_E2E_BINARY=/artifacts/xray-7001-current go test -race ./internal/web/service ./internal/web/controller -run '^TestVless' -count=1go test -race ./internal/web/service -run 'PostgresCommitFailure|^TestSyncInboundClientsOnPostgres$|^TestSetClientLimitHwidIsSerializedWithSyncInbound$|^TestVlessManagedFallbackConflictPostgres$' -count=1 -vmake node-e2ego test ./internal/util/link -run '^$' -fuzz '^FuzzParseLink$' -fuzztime=30s -parallel=2go test ./internal/web/runtime -run '^$' -fuzz '^FuzzDecodeCertPin$' -fuzztime=30s -parallel=2make vulncheckcd frontend && npm run gen; copy OpenAPI to docs;cd docs && npm run gen:apiactionlint -shellcheck= .github/workflows/ci.yml;git diff --cached --checkAn overlapping race/frontend run hit four existing 5-second component-test timeouts. The unchanged tests passed when the full
make verifywas rerun by itself; timeouts were not raised. Default actionlint separately reports existing SC2046 warnings in unchanged workflow scripts (lines 40 and 241); structural workflow validation above passes.Ordinary Go runs skip environment-gated integrations; the live PostgreSQL, actual-core and master/node checks listed above were run separately. The tested Linux files were compared against the staged Git content with
git diff --exit-codeand matched exactly.The initial regression run failed for Add/Update, managed rules and every legacy runtime path with the reported fallback conflict. The frontend reproduction failed because adding fallbacks remained enabled. Both became green after the changes. The healthy-core test also first failed because the refusal reason was absent, then passed after exposing it.
Actual Xray validation: the tests call the embedded Xray-core VLESS/Trojan config builders, not just JSON-key assertions. A real core built from the exact
go.moddependency (v1.260327.1-0.20261021115930-1b1647cd9ddf) remains running and answers its gRPC API after both forced and ordinary restart attempts reject a conflicting candidate.Xray status follow-up
The broader crash-loop status issue is deferred, not claimed fixed. A separate automated reproduction seeded a cached running status with no current Xray process:
CurrentStatus()still returnedrunningwith an empty error whileIsXrayRunning()was false.CurrentStatus()reuses the periodic snapshot, and process replacement also clears the cached result. That demonstrates a stale-status mechanism; it does not establish the complete cause of the reporter's sustained polling results. A separate lifecycle/status change should test exited children and watchdog retries together. This PR prevents the reported VLESS candidate from causing that crash loop and exposes the reason when a healthy core keeps its previous config.Raw nonempty legacy fallback conflicts require administrator correction; routing is never silently discarded.
Related issue
Fixes #7001
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
[PR #7003] fix(inbounds): reject incompatible VLESS fallbacks and prevent Xray crashesto [PR #7003] [MERGED] fix(inbounds): reject incompatible VLESS fallbacks and prevent Xray crashes