[PR #6507] [MERGED] fix(link): read the vmess certificate checks on import #6316

Closed
opened 2026-11-02 04:07:54 +07:00 by bsakaguchi · 0 comments
Owner

📋 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)

  • aa9e3c8 fix(link): read the vmess certificate checks on import
  • 66219f9 fix(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

parseVmess now reads ech, vcn and pcs from the vmess share object. Importing a vmess link the panel had just exported no longer discards the certificate checks it carries.

Why

applyVmessTLSParams writes six TLS fields into the share object — sni, fp, alpn, ech, vcn, pcs (internal/sub/service.go:1797-1821) — while parseVmess read back only the first three. The same three the url-param protocols read in applySecurity (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:

exported: {"sni":"vmess.example.com","fp":"chrome","alpn":"h2","ech":"AEX+DQBB","vcn":"vcn.example.com","pcs":"AAAA…=",…}
imported: {"alpn":["h2"],"echConfigList":"","fingerprint":"chrome","pinnedPeerCertSha256":"","serverName":"vmess.example.com","verifyPeerCertByName":""}

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 as pcs. 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 dropped allowInsecure in 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 plugin parameter; 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 applySecurity exactly:

  • ech → echConfigList
  • vcn → verifyPeerCertByName
  • pcs → pinnedPeerCertSha256

pinnedPeerCertSha256 is filled as the joined string the core reads (infra/conf/transport_security.go:314 declares it as a string), which is also the shape the url-param path and SubJsonService already 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

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

internal/sub/vmess_tls_import_test.go: genVmessLink on a vmess inbound whose tlsSettings.settings carries a fingerprint, an ECH config, a verify-by-name and one pin, then link.ParseLink on the result, asserting all five fields plus alpn. Run against main's outbound.go it fails on exactly the three fields this PR adds:

tlsSettings["echConfigList"] = , want "AEX+DQBB"
tlsSettings["verifyPeerCertByName"] = , want "vcn.example.com"
tlsSettings["pinnedPeerCertSha256"] = , want "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

Local run: this machine has no C compiler, so the Go tests ran with a pure-Go SQLite driver (modernc.org/sqlite) substituted behind go build -overlay, whose only entries are internal/database's driver call sites — no file this PR touches is overlaid. go test ./internal/util/link/ ./internal/sub/ — both green; gofmt and go vet clean on both packages.

Screenshots / recordings

N/A — wire format, covered above.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior. (pure-Go driver behind an overlay, see above)
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally. (as-is they need the CGo driver; CI covers that)
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass. (no frontend change in this PR)
  • I updated the Wiki / README / API docs if user-facing behavior changed. (no docs describe this import detail)
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6507 **Author:** [@BlindMaster24](https://github.com/BlindMaster24) **Created:** 9/13/2026 **Status:** ✅ Merged **Merged:** 9/13/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/link-vmess-tls-pins` --- ### 📝 Commits (2) - [`aa9e3c8`](https://github.com/MHSanaei/3x-ui/commit/aa9e3c8577188d28a78df209f79a8fe6c22559b4) fix(link): read the vmess certificate checks on import - [`66219f9`](https://github.com/MHSanaei/3x-ui/commit/66219f9ad43ec8be896168302e9a940a4097642e) fix(frontend): read the vmess certificate checks on import ### 📊 Changes **4 files changed** (+98 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 Description ## Summary `parseVmess` now reads `ech`, `vcn` and `pcs` from the vmess share object. Importing a vmess link the panel had just exported no longer discards the certificate checks it carries. ## Why `applyVmessTLSParams` writes six TLS fields into the share object — `sni`, `fp`, `alpn`, `ech`, `vcn`, `pcs` (`internal/sub/service.go:1797-1821`) — while `parseVmess` read back only the first three. The same three the url-param protocols read in `applySecurity` (`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`: ``` exported: {"sni":"vmess.example.com","fp":"chrome","alpn":"h2","ech":"AEX+DQBB","vcn":"vcn.example.com","pcs":"AAAA…=",…} imported: {"alpn":["h2"],"echConfigList":"","fingerprint":"chrome","pinnedPeerCertSha256":"","serverName":"vmess.example.com","verifyPeerCertByName":""} ``` 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 as `pcs`. 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 dropped `allowInsecure` in 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 `plugin` parameter; 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 `applySecurity` exactly: - `ech` → `echConfigList` - `vcn` → `verifyPeerCertByName` - `pcs` → `pinnedPeerCertSha256` `pinnedPeerCertSha256` is filled as the joined string the core reads (`infra/conf/transport_security.go:314` declares it as a `string`), which is also the shape the url-param path and `SubJsonService` already 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 - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [ ] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [x] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? `internal/sub/vmess_tls_import_test.go`: `genVmessLink` on a vmess inbound whose `tlsSettings.settings` carries a fingerprint, an ECH config, a verify-by-name and one pin, then `link.ParseLink` on the result, asserting all five fields plus `alpn`. Run against `main`'s `outbound.go` it fails on exactly the three fields this PR adds: ``` tlsSettings["echConfigList"] = , want "AEX+DQBB" tlsSettings["verifyPeerCertByName"] = , want "vcn.example.com" tlsSettings["pinnedPeerCertSha256"] = , want "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=" ``` Local run: this machine has no C compiler, so the Go tests ran with a pure-Go SQLite driver (`modernc.org/sqlite`) substituted behind `go build -overlay`, whose only entries are `internal/database`'s driver call sites — no file this PR touches is overlaid. `go test ./internal/util/link/ ./internal/sub/` — both green; `gofmt` and `go vet` clean on both packages. ## Screenshots / recordings N/A — wire format, covered above. ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. (pure-Go driver behind an overlay, see above) - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. (as-is they need the CGo driver; CI covers that) - [ ] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. (no frontend change in this PR) - [x] I updated the Wiki / README / API docs if user-facing behavior changed. (no docs describe this import detail) - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:07:54 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6316
No description provided.