[PR #6451] [MERGED] fix(sub): enable ML-KEM for Mihomo REALITY subscriptions #6271

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6451
Author: @King19950905
Created: 9/11/2026
Status: ✅ Merged
Merged: 9/11/2026
Merged by: @MHSanaei

Base: main ← Head: codex/mihomo-reality-mlkem


📝 Commits (1)

  • 10b6328 fix(sub): enable ML-KEM for Mihomo REALITY subscriptions

📊 Changes

6 files changed (+103 additions, -23 deletions)

View changed files

📝 docs/content/docs/en/config/reality.mdx (+15 -7)
📝 docs/content/docs/fa/config/reality.mdx (+23 -7)
📝 docs/content/docs/ru/config/reality.mdx (+15 -8)
📝 docs/content/docs/zh/config/reality.mdx (+2 -1)
📝 internal/sub/clash_service.go (+3 -0)
📝 internal/sub/clash_service_test.go (+45 -0)

📄 Description

Summary

Enable reality-opts.support-x25519mlkem768 in generated Clash/Mihomo REALITY proxies. Xray-core v26.9.8+ requires an ML-KEM key share, while Mihomo otherwise strips it by default; a correctly configured Chrome REALITY node could therefore time out after the server upgrade.

The shared security mapper covers both panel inbounds and external share links converted into YAML. Use chrome only when the fingerprint is absent, preserving explicit choices, public keys and short IDs. Plain TLS and non-TLS proxies are unchanged, and legacy Clash still excludes REALITY.

Update the REALITY pitfalls in all four documentation languages: v26.9.8+ removed the implicit minimum client version, but explicit version gates and the separate ML-KEM handshake requirement still apply.

Refs MetaCubeX/mihomo#3193 and XTLS/REALITY@8cdf7bf9c7.

Type of change

  • Bug fix
  • Documentation

Areas affected

  • Subscription (Clash/Mihomo YAML)

Validation

  • Targeted REALITY regression tests pass for local inbounds and external links, absent/Chrome/Firefox fingerprints, and REALITY/TLS/plain security.
  • Re-running the new tests against the original implementation via a Go source overlay fails on the missing ML-KEM flag.
  • go build ./... passes with the repository's internal/web/dist/.gitkeep embed stub.
  • go test -shuffle=on -count=1 ./...: subscription tests and the other packages pass, but the full run is not green on macOS arm64. MTProto process tests (TestEnsureNoopKeepsProcess, TestEnsureReloadFallbackRestarts, TestEnsureHotReloadKeepsProcess, and on the first run TestProcessStatusDuringExit) time out waiting for a spawn. Those tests pass in isolation against the original implementation; no MTProto files were changed. The failure also occurred on a second full run.
  • No live client/server handshake test was performed. No frontend code or dependency versions changed.

Compatibility

This intentionally changes the generated REALITY client setting to enable ML-KEM. Very old REALITY servers that reject ML-KEM need a per-node client override setting the option to false, or a server upgrade. Server versions cannot be inferred reliably for external links or remote nodes, so this does not guess from the panel's local core version.

The flag does not add ML-KEM to an incompatible fingerprint. Explicit choices are preserved; with Mihomo's uTLS v1.8.7, use chrome. Raw vless:// subscriptions still cannot carry this Mihomo option and require a client override when imported directly. Server-side minClientVer/maxClientVer values are not changed.

Checklist

  • Added regression tests that fail before the fix.
  • Updated user-facing documentation.
  • Kept the change scoped; no new dependencies or migrations.

🔄 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/6451 **Author:** [@King19950905](https://github.com/King19950905) **Created:** 9/11/2026 **Status:** ✅ Merged **Merged:** 9/11/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `codex/mihomo-reality-mlkem` --- ### 📝 Commits (1) - [`10b6328`](https://github.com/MHSanaei/3x-ui/commit/10b63284fe5c322f57d5f2de86270127c9adf695) fix(sub): enable ML-KEM for Mihomo REALITY subscriptions ### 📊 Changes **6 files changed** (+103 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/en/config/reality.mdx` (+15 -7) 📝 `docs/content/docs/fa/config/reality.mdx` (+23 -7) 📝 `docs/content/docs/ru/config/reality.mdx` (+15 -8) 📝 `docs/content/docs/zh/config/reality.mdx` (+2 -1) 📝 `internal/sub/clash_service.go` (+3 -0) 📝 `internal/sub/clash_service_test.go` (+45 -0) </details> ### 📄 Description ## Summary Enable `reality-opts.support-x25519mlkem768` in generated Clash/Mihomo REALITY proxies. Xray-core v26.9.8+ requires an ML-KEM key share, while Mihomo otherwise strips it by default; a correctly configured Chrome REALITY node could therefore time out after the server upgrade. The shared security mapper covers both panel inbounds and external share links converted into YAML. Use `chrome` only when the fingerprint is absent, preserving explicit choices, public keys and short IDs. Plain TLS and non-TLS proxies are unchanged, and legacy Clash still excludes REALITY. Update the REALITY pitfalls in all four documentation languages: v26.9.8+ removed the implicit minimum client version, but explicit version gates and the separate ML-KEM handshake requirement still apply. Refs MetaCubeX/mihomo#3193 and XTLS/REALITY@8cdf7bf9c7f09cb9814bf08c3eb877f68b85fba8. ## Type of change - [x] Bug fix - [x] Documentation ## Areas affected - [x] Subscription (Clash/Mihomo YAML) ## Validation - Targeted REALITY regression tests pass for local inbounds and external links, absent/Chrome/Firefox fingerprints, and REALITY/TLS/plain security. - Re-running the new tests against the original implementation via a Go source overlay fails on the missing ML-KEM flag. - `go build ./...` passes with the repository's `internal/web/dist/.gitkeep` embed stub. - `go test -shuffle=on -count=1 ./...`: subscription tests and the other packages pass, but the full run is not green on macOS arm64. MTProto process tests (`TestEnsureNoopKeepsProcess`, `TestEnsureReloadFallbackRestarts`, `TestEnsureHotReloadKeepsProcess`, and on the first run `TestProcessStatusDuringExit`) time out waiting for a spawn. Those tests pass in isolation against the original implementation; no MTProto files were changed. The failure also occurred on a second full run. - No live client/server handshake test was performed. No frontend code or dependency versions changed. ## Compatibility This intentionally changes the generated REALITY client setting to enable ML-KEM. Very old REALITY servers that reject ML-KEM need a per-node client override setting the option to `false`, or a server upgrade. Server versions cannot be inferred reliably for external links or remote nodes, so this does not guess from the panel's local core version. The flag does not add ML-KEM to an incompatible fingerprint. Explicit choices are preserved; with Mihomo's uTLS v1.8.7, use `chrome`. Raw `vless://` subscriptions still cannot carry this Mihomo option and require a client override when imported directly. Server-side `minClientVer`/`maxClientVer` values are not changed. ## Checklist - [x] Added regression tests that fail before the fix. - [x] Updated user-facing documentation. - [x] Kept the change scoped; no new dependencies or migrations. --- <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:35 +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#6271
No description provided.