mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6474] [Bug]: Go share-link importer drops verifyPeerCertByName (vcn); TS keeps it #4368
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#4368
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/6474
Describe the bug
Share links emit
vcnwhen the inbound hasverifyPeerCertByNameset (cert CN differs from SNI). The TypeScript outbound importer applies it; the Go importer's sharedapplySecurityhelper does not. External-link / JSON subscription paths that parse links in Go therefore emit outbounds that fail TLS when the peer cert name must be checked explicitly.How to reproduce the problem
verifyPeerCertByNameset to a name that differs from SNI.vcn=...(generator:internal/sub/service.gosetsparams["vcn"]).tlsSettings.verifyPeerCertByNameset.internal/util/linkused frominternal/sub/external_config.go) →verifyPeerCertByNamestays"".Expected behavior
Go and TS importers both apply
vcn→tlsSettings.verifyPeerCertByNamefor TLS links (same as Hysteria already does in Go atparseHysteria2).Actual behavior
applySecurityreadssni/fp/alpn/ech/pcsonly and leaves the emptyverifyPeerCertByNameseeded bybuildStream. TSapplySecurityParamssetstls.verifyPeerCertByNamefromvcn.File pointers (main @
0a2cd789ba)internal/sub/service.go(emitsparams["vcn"]for TLS inbounds with verifyPeerCertByName).internal/util/link/outbound.go→applySecurityTLS branch (novcnread). Contrast: Hysteria path already mapsvcn.frontend/src/lib/xray/outbound-link-parser.ts→applySecurityParamssetstls.verifyPeerCertByName = params.get('vcn').Suggested fix size
Small: one assignment in Go
applySecurityTLS branch (tls["verifyPeerCertByName"] = p.Get("vcn")), plus a regression test next to existing link-parse coverage.3x-ui version
main (post-3.7.0)
@github-actions[bot] commented on GitHub (Sep 11, 2026):
Confirmed — the Go share-link importer does drop
vcn, and it is still dropped at the tip ofmain(0a2cd789). Your file pointers are accurate, and the divergence is wider than the one helper you named.What the source says
The generator emits it.
applyShareTLSParamsis the shared TLS-param builder for the vless / trojan / shadowsocks links (called atinternal/sub/service.go:1063,:1116,:1191):The Go importer reads
pcsfrom that same pair but nevervcn:so the
"verifyPeerCertByName": ""seeded atinternal/util/link/outbound.go:583survives.applySecurityis called only fromparseVless(:274) andparseTrojan(:316). The Hysteria2 branch does map it —"verifyPeerCertByName": params.Get("vcn"),atinternal/util/link/outbound.go:455— and TS does too, atfrontend/src/lib/xray/outbound-link-parser.ts:399.Two things your report did not cover
applyVmessTLSParamswritesobj["vcn"]into the vmess JSON (internal/sub/service.go:1711), butparseVmesshas its own inline TLS block that only mapssni/fp/alpn: It dropsechandpcsthere as well, so a one-line fix inapplySecurityalone still leaves vmess broken.internal/sub/json_service.go:182→parsedExternalOutbound),link.ParseSubscriptionBodyalso feeds the panel's own outbound subscriptions atinternal/web/service/outbound_subscription.go:394. There the parsed outbounds become the panel's own Xray client config, so a fetched upstream link withvcngives the local Xray an outbound that fails peer verification. (The Clash external path,internal/sub/clash_external.go:15, is unaffected — mihomo has no equivalent field and the converter never reads it.)How it got here
7c888946("feat(tls,reality): port xray TLS/REALITY fields…") addedvcnto the generators and to the TS parser; its file list does not includeinternal/util/link/at all, so the Go importer was never updated.5e1cb769(#5970) later noticed the gap and fixed exactly one branch — its own commit message says "parseHysteria2 hardcoded verifyPeerCertByName to empty, ignoring the vcn param the panel emits… The TS parser handles both; make the Go parser match." — and shippedTestParse_Hysteria2VerifyPeerCertByName(internal/util/link/outbound_helpers_test.go:193). The vless/trojan and vmess branches were left behind. Nothing in the source defends the omission:TestParse_TLSSecurityMapped(internal/util/link/outbound_helpers_test.go:125) assertsserverName,fingerprint,echConfigList,pinnedPeerCertSha256andalpnfor a trojan link and simply has novcncase.Suggested fix: map
vcnin theapplySecurityTLS branch alongside the existingpcsline, and mirror it in theparseVmessTLS block atinternal/util/link/outbound.go:201;TestParse_TLSSecurityMappedis the natural home for the regression assertion. Keep it to those two assignments — the gap is a missed field, not a missing layer.Verdict: Confirmed bug
Severity: Medium
Confidence: High
Root cause:
applySecurityininternal/util/link/outbound.go:658(TLS branch, lines 661-669) never reads thevcnquery param, leaving the"verifyPeerCertByName": ""seed frombuildStream(internal/util/link/outbound.go:583);parseVmess(internal/util/link/outbound.go:201-208) has the same omission for the vmess JSON form. Triggered whenever a link carryingvcnis parsed in Go — i.e. the source inbound hastlsSettings.settings.verifyPeerCertByNameset. Introduced by7c888946, which updated the generators and the TS parser but notinternal/util/link/;5e1cb769(#5970) fixed only the Hysteria2 branch.Already fixed: Still present on the default branch (
0a2cd789, the tip as of this run); no commit or merged PR since v3.7.0 touches the TLS branch ofapplySecurity.Duplicate of: None. Related: #6477 is this same report re-filed one minute later by the same author; it should be closed in favour of this one.
Evidence:
internal/sub/service.go:1676-1681(params["vcn"]+params["pcs"]emitted together);internal/sub/service.go:1711-1713(vmessobj["vcn"]);internal/util/link/outbound.go:658-669(applySecurity, readspcs, notvcn);internal/util/link/outbound.go:583("verifyPeerCertByName": ""seed);internal/util/link/outbound.go:455(Hysteria2 maps it);internal/util/link/outbound.go:201-208(vmess drops it);frontend/src/lib/xray/outbound-link-parser.ts:399(TS keeps it); consumersinternal/sub/json_service.go:182andinternal/web/service/outbound_subscription.go:394; testsinternal/util/link/outbound_helpers_test.go:125and:193; commits7c888946,5e1cb769.Not determined: Whether the shadowsocks branch is affected the same way.
genShadowsocksLinkdoes callapplyShareTLSParams(internal/sub/service.go:1191) and so emitsvcn, butparseShadowsocksdiscards the entire query string atinternal/util/link/outbound.go:345-347and emits nostreamSettingsat all — a broader, separate gap that avcnfix would not address, and which I did not investigate further. ReadingparseShadowsocksagainst the TS shadowsocks parser would settle whether that is deliberate.This reply was generated automatically; a maintainer may follow up.