mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6126] [MERGED] feat(ui): validate the REALITY client version range at save time #6089
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#6089
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/6126
Author: @PathGao
Created: 7/28/2026
Status: ✅ Merged
Merged: 7/28/2026
Merged by: @MHSanaei
Base:
main← Head:fix-reality-clientver-validation📝 Commits (2)
d7be5e0feat(ui): validate the REALITY client version range at save timee6b0fcbfix(ui): reject untrimmed client versions and revalidate max on min edits📊 Changes
16 files changed (+171 additions, -1 deletions)
View changed files
📝
frontend/src/lib/xray/stream-wire-normalize.ts(+57 -0)📝
frontend/src/pages/inbounds/form/security/reality.tsx(+28 -1)📝
frontend/src/test/stream-wire-normalize.test.ts(+60 -0)📝
internal/web/translation/ar-EG.json(+2 -0)📝
internal/web/translation/en-US.json(+2 -0)📝
internal/web/translation/es-ES.json(+2 -0)📝
internal/web/translation/fa-IR.json(+2 -0)📝
internal/web/translation/id-ID.json(+2 -0)📝
internal/web/translation/ja-JP.json(+2 -0)📝
internal/web/translation/pt-BR.json(+2 -0)📝
internal/web/translation/ru-RU.json(+2 -0)📝
internal/web/translation/tr-TR.json(+2 -0)📝
internal/web/translation/uk-UA.json(+2 -0)📝
internal/web/translation/vi-VN.json(+2 -0)📝
internal/web/translation/zh-CN.json(+2 -0)📝
internal/web/translation/zh-TW.json(+2 -0)📄 Description
Summary
Follow-up to #6125, as promised in its review thread: validate the REALITY Min Client Ver / Max Client Ver fields at save time — format matching xray-core's parser, plus a cross-field check that a non-empty max is not below a non-empty min — so an inverted range that rejects every client can no longer be saved.
Why
#6125 documented the client-version gate, but a tooltip only helps a user who hovers it. The automated review on that PR pointed out the remaining hole: nothing stopped a user from saving
maxClientVer = 25.9.11against the effective minimum26.3.27— a range that rejects every client, with no feedback at save time and a hard-to-diagnose "clients time out" symptom later.The validators mirror xray-core's config loader exactly (
infra/conf/transport_security.go): up to three dot-separated numeric parts, each 0-255, empty meaning "not set". Short versions are padded before comparison the way the core pads them (26==26.0.0). A malformed min is reported by the min field itself and skipped by the max comparison, so each field shows one precise error.Type of change
Areas affected
How was this tested?
frontend/src/test/stream-wire-normalize.test.tscovering: core-style accepts (26,26.3,26.3.27,0.0.255), core-style rejects (four parts, part > 255, non-numeric, empty parts), the exact stale-placeholder trap from #6125 (25.9.11vs26.3.27), short-version padding, and precedence of format errors over range errors.26.3.27/25.9.11and pressing Create blocks the save with a field-level "Max Client Ver must not be lower than Min Client Ver"; a malformed value shows the format error; correcting the values and resubmitting saves cleanly.npm run lint,npm run typecheck,npm run test,npm run buildpass; both new error keys are present in all 13 locale files (script-asserted).Screenshots / recordings
The only visible change is a standard field-level validation error under the offending field when saving an invalid version or an inverted range — same presentation as the existing REALITY target validation.
Breaking changes
None. Previously-savable invalid values are now rejected at the form; values already stored in the DB are unaffected.
Behavior notes for reviewers:
src/lib/xray/stream-wire-normalize.tsreturning i18n keys, wired viarules.validate. Errors surface when the user presses Create (the modal validates viatrigger()), matching how every other field in this form behaves.Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.