mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6507] [MERGED] fix(link): read the vmess certificate checks on import #6316
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#6316
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/6507
Author: @BlindMaster24
Created: 9/13/2026
Status: ✅ Merged
Merged: 9/13/2026
Merged by: @MHSanaei
Base:
main← Head:fix/link-vmess-tls-pins📝 Commits (2)
aa9e3c8fix(link): read the vmess certificate checks on import66219f9fix(frontend): read the vmess certificate checks on import📊 Changes
4 files changed (+98 additions, -0 deletions)
View changed files
📝
frontend/src/lib/xray/outbound-link-parser.ts(+5 -0)📝
frontend/src/test/outbound-link-parser.test.ts(+28 -0)➕
internal/sub/vmess_tls_import_test.go(+60 -0)📝
internal/util/link/outbound.go(+5 -0)📄 Description
Summary
parseVmessnow readsech,vcnandpcsfrom the vmess share object. Importing a vmess link the panel had just exported no longer discards the certificate checks it carries.Why
applyVmessTLSParamswrites six TLS fields into the share object —sni,fp,alpn,ech,vcn,pcs(internal/sub/service.go:1797-1821) — whileparseVmessread back only the first three. The same three the url-param protocols read inapplySecurity(internal/util/link/outbound.go:711-714) were the ones missing here, so vmess was the only protocol that lost them.Reproduced through the exporter itself on current
main:All three arrive empty.
Operator scenario. A vmess inbound whose certificate is trusted only through a pin — the case the panel calls out as the replacement for the removed
allowInsecure(verifyPeerCertByNameValue's own comment) — exports that pin aspcs. The subscriber pastes the link into another panel, or a second node pulls it as an external subscription (internal/sub/external_config.go:216,internal/web/service/outbound_subscription.go:394). The pin is gone, so the outbound verifies against the system roots instead: it saves without a warning and cannot reach the server. The vless/trojan/ss equivalents keep their pins today, so the same certificate setup works on every protocol except vmess. xray-core has also droppedallowInsecurein favour of exactly these fields (infra/conf/transport_security.go:362), which is what makes losing them harder to work around in the client.Same class as #6467, which preserved the shadowsocks TLS query params on import, and as #6505 for the shadowsocks
pluginparameter; this is the last of the three the panel exports and the importer never read.What changed
Three assignments in the vmess TLS block, matching
applySecurityexactly:ech→echConfigListvcn→verifyPeerCertByNamepcs→pinnedPeerCertSha256pinnedPeerCertSha256is filled as the joined string the core reads (infra/conf/transport_security.go:314declares it as astring), which is also the shape the url-param path andSubJsonServicealready write. A link that carries none of the three gets empty values, the same as before. Nothing else about vmess parsing changes, and the other protocols are untouched.Type of change
Areas affected
How was this tested?
internal/sub/vmess_tls_import_test.go:genVmessLinkon a vmess inbound whosetlsSettings.settingscarries a fingerprint, an ECH config, a verify-by-name and one pin, thenlink.ParseLinkon the result, asserting all five fields plusalpn. Run againstmain'soutbound.goit fails on exactly the three fields this PR adds:Local run: this machine has no C compiler, so the Go tests ran with a pure-Go SQLite driver (
modernc.org/sqlite) substituted behindgo build -overlay, whose only entries areinternal/database's driver call sites — no file this PR touches is overlaid.go test ./internal/util/link/ ./internal/sub/— both green;gofmtandgo vetclean on both packages.Screenshots / recordings
N/A — wire format, covered above.
Breaking changes
None.
Checklist
go build ./...and the test suite pass locally. (as-is they need the CGo driver; CI covers that)npm run lint,npm run typecheck, andnpm run buildpass. (no frontend change in this PR)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.