[PR #6576] [MERGED] fix(sub): preserve external VLESS encryption in Clash subscriptions #6356

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6576
Author: @SakikoTogawa0214
Created: 9/16/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @MHSanaei

Base: main ← Head: codex/pr-6572-verified


📝 Commits (2)

  • f3cce35 fix(sub): preserve external VLESS encryption in Clash subscriptions
  • b8739c0 test(nodes): wait for chart effects in history panel assertions

📊 Changes

3 files changed (+146 additions, -13 deletions)

View changed files

📝 frontend/src/test/node-history-panel.test.tsx (+16 -13)
📝 internal/sub/clash_external.go (+6 -0)
➕ internal/sub/clash_external_vless_test.go (+124 -0)

📄 Description

Summary

Preserve VLESS encryption when external share links and fetched subscriptions are merged into Clash/Mihomo YAML. Trim whitespace and omit empty or none values, matching the existing local inbound export.

Why

The external-link parser already retains encryption, but the Clash converter drops it. Encrypted external VLESS nodes therefore lose a required connection parameter in the generated subscription.

Closes #6572.

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?

  • Added 10 regression cases covering encrypted/plain values, whitespace, UUID/flow preservation, and merged direct-link, HTTPS plaintext, and HTTPS Base64 sources. They fail with the original converter and pass with this fix, including the race detector:

    go test -race ./internal/sub -run 'TestClash(ExternalVlessEncryption|MergedExternalVlessEncryption)$' -count=1 -v
    
  • Separately verified real Mihomo 1.19.31 and Xray 26.9.9 connections locally for all three external sources: retaining encryption connects; removing it reproduces the connection failure.

  • Full CI on this exact commit: all 8 jobs passed, including Go tests, race + shuffle, PostgreSQL, fuzzing, lint, code generation, vulnerability checks, and frontend validation (166 files / 1,608 tests).

  • Build matrix on this exact commit: all 8 Linux/Windows platform builds passed.

Breaking changes

None.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the full test suite pass on Ubuntu CI (linked above); focused regression and real-core checks also pass locally.
  • npm run lint, npm run typecheck, and npm run build pass in CI; no frontend files changed.
  • I updated the Wiki / README / API docs if user-facing behavior changed. (N/A: restores the existing encryption export behavior; no API or configuration changes.)
  • 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/6576 **Author:** [@SakikoTogawa0214](https://github.com/SakikoTogawa0214) **Created:** 9/16/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `codex/pr-6572-verified` --- ### 📝 Commits (2) - [`f3cce35`](https://github.com/MHSanaei/3x-ui/commit/f3cce35b2f8e28a9c0de7d7c53aaabd0d7e35598) fix(sub): preserve external VLESS encryption in Clash subscriptions - [`b8739c0`](https://github.com/MHSanaei/3x-ui/commit/b8739c024d4b1fa967e34fe6a7b2956a5f711039) test(nodes): wait for chart effects in history panel assertions ### 📊 Changes **3 files changed** (+146 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/test/node-history-panel.test.tsx` (+16 -13) 📝 `internal/sub/clash_external.go` (+6 -0) ➕ `internal/sub/clash_external_vless_test.go` (+124 -0) </details> ### 📄 Description ## Summary Preserve VLESS `encryption` when external share links and fetched subscriptions are merged into Clash/Mihomo YAML. Trim whitespace and omit empty or `none` values, matching the existing local inbound export. ## Why The external-link parser already retains `encryption`, but the Clash converter drops it. Encrypted external VLESS nodes therefore lose a required connection parameter in the generated subscription. Closes #6572. ## 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? - Added 10 regression cases covering encrypted/plain values, whitespace, UUID/flow preservation, and merged direct-link, HTTPS plaintext, and HTTPS Base64 sources. They fail with the original converter and pass with this fix, including the race detector: ```sh go test -race ./internal/sub -run 'TestClash(ExternalVlessEncryption|MergedExternalVlessEncryption)$' -count=1 -v ``` - Separately verified real Mihomo 1.19.31 and Xray 26.9.9 connections locally for all three external sources: retaining `encryption` connects; removing it reproduces the connection failure. - [Full CI on this exact commit](https://github.com/SakikoTogawa0214/3x-ui/actions/runs/35104566342): all 8 jobs passed, including Go tests, race + shuffle, PostgreSQL, fuzzing, lint, code generation, vulnerability checks, and frontend validation (166 files / 1,608 tests). - [Build matrix on this exact commit](https://github.com/SakikoTogawa0214/3x-ui/actions/runs/35104566389): all 8 Linux/Windows platform builds passed. ## Breaking changes None. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] `go build ./...` and the full test suite pass on Ubuntu CI (linked above); focused regression and real-core checks also pass locally. - [x] `npm run lint`, `npm run typecheck`, and `npm run build` pass in CI; no frontend files changed. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. (N/A: restores the existing encryption export behavior; no API or configuration changes.) - [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:08:12 +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#6356
No description provided.