mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #6477] [Bug]: Go share-link importer drops verifyPeerCertByName (vcn); TS keeps it #4371
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#4371
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 @mrchatam on GitHub (Sep 11, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6477
Describe the bug
When an inbound sets
verifyPeerCertByName, the panel's share-link generators emitvcnon the query string (internal/sub/service.go). The TypeScript importer applies it (frontend/src/lib/xray/outbound-link-parser.tssetstls.verifyPeerCertByNamefromvcn), but the Go importer'sapplySecuritydoes not — it readssni/fp/alpn/ech/pcsonly and leavesverifyPeerCertByNameas the empty string seeded bybuildStream.Consequence: the same share link produces different TLS settings depending on which importer runs. Paths that use the Go parser (including external-link JSON subscription materialization via
internal/sub/external_config.go→ link parse →json_service.go) emit an outbound that verifies against the wrong name and fails the handshake when the cert CN differs from the SNI.Note:
parseHysteria2in the same Go file does readvcn; the omission is specific toapplySecurity(used by VLESS / Trojan / Shadowsocks).How to reproduce the problem
verifyPeerCertByNameto that CN.vcn=<cn>is present in the query.internal/util/link).Expected behavior
Go and TS importers both set
tlsSettings.verifyPeerCertByNamefromvcn, matching what the generator emitted.Actual behavior
TS import keeps
vcn; Go import drops it. Clients built from the Go path fail TLS when the peer cert name must be checked explicitly.File pointers
internal/sub/service.go(setsparams["vcn"])internal/util/link/outbound.go→applySecurity(tls branch)frontend/src/lib/xray/outbound-link-parser.ts(~line applyingvcn)parseHysteria2already mapsvcn3x-ui version
main (current default branch)
Suggested fix size
Small: one assignment in
applySecurity's TLS branch (tls["verifyPeerCertByName"] = p.Get("vcn")), plus a regression test next to the existing link-parser coverage.@github-actions[bot] commented on GitHub (Sep 11, 2026):
You are right about the defect, but this is a duplicate: you filed the same report as #6474 one minute earlier (#6474 created
16:53:36Z, this one16:54:36Z), and #6474 already carries the full analysis. Closing this one and keeping #6474 as the tracking issue — nothing is lost.The shared root cause, confirmed in the source
applySecuritynever readsvcn, so the empty seed survives:The seed is
"verifyPeerCertByName": ""atinternal/util/link/outbound.go:583. The generator emits the param —params["vcn"] = vcninapplyShareTLSParams(internal/sub/service.go:1676-1678), right next to theparams["pcs"]the importer does read. Hysteria2 maps it (internal/util/link/outbound.go:455) and so does TS (frontend/src/lib/xray/outbound-link-parser.ts:399). Still present at the tip ofmain(0a2cd789).Two corrections to this report, both already recorded on #6474
applySecurityconsumer. The only callers areparseVless(internal/util/link/outbound.go:274) andparseTrojan(:316).parseShadowsocksthrows the entire query away before parsing —if i := strings.Index(link, "?"); i >= 0 { link = link[:i] }(internal/util/link/outbound.go:345-347) — and returns an outbound with nostreamSettingsat all, so it losessni/fp/pcstoo, not justvcn. That is a separate, wider gap.vcnin a second place.applyVmessTLSParamswritesobj["vcn"](internal/sub/service.go:1711-1713), butparseVmesshas its own inline TLS block mapping onlysni/fp/alpn(internal/util/link/outbound.go:201-208). A one-line fix inapplySecurityleaves that one broken.Follow #6474 for the rest.
Verdict: Duplicate
Severity: Medium
Confidence: High
Root cause:
applySecurityininternal/util/link/outbound.go:658(TLS branch, lines 661-669) never reads thevcnquery param, so the"verifyPeerCertByName": ""seeded bybuildStream(internal/util/link/outbound.go:583) survives every Go parse of a vless/trojan link. Introduced by7c888946("feat(tls,reality): port xray TLS/REALITY fields…"), whose file list contains nointernal/util/link/path while it addedvcnto both generators and to the TS parser;5e1cb769(#5970) later fixed only the Hysteria2 branch.Already fixed: Still present on the default branch (
0a2cd789).Duplicate of: #6474 — identical report by the same author one minute earlier, same root cause (
applySecurityomitsvcn), already analysed there.Evidence:
internal/util/link/outbound.go:658-679(applySecurity, readspcsbut notvcn);:583(empty seed);:455(Hysteria2 mapsvcn);:201-208(vmess drops it);:274,:316(the onlyapplySecuritycallers);:345-347(parseShadowsocksdiscards the query);internal/sub/service.go:1676-1678and:1711-1713(generators emitvcn);frontend/src/lib/xray/outbound-link-parser.ts:399(TS applies it); consumersinternal/sub/json_service.go:182andinternal/web/service/outbound_subscription.go:394; testsinternal/util/link/outbound_helpers_test.go:125(TLS fields pinned, novcncase) and:193(TestParse_Hysteria2VerifyPeerCertByName); commits7c888946,5e1cb769.Not determined: None for the duplicate call — both issues state the same defect at the same lines.
This reply was generated automatically; a maintainer may follow up.