[PR #7049] [CLOSED] fix(frontend): ensure QR code displays for X25519 VLESS links (#7034) #6619

Closed
opened 2026-11-07 14:34:11 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/7049
Author: @DoctorGuidance
Created: 11/2/2026
Status: ❌ Closed

Base: main ← Head: fix/vless-x25519-qr-display


📝 Commits (1)

  • 6fbb63b fix(frontend): ensure QR code displays for X25519 VLESS links (#7034)

📊 Changes

2 files changed (+41 additions, -4 deletions)

View changed files

📝 frontend/src/lib/xray/inbound-link.ts (+15 -4)
📝 frontend/src/test/inbound-link.test.ts (+26 -0)

📄 Description

Summary of Changes

Fixes #7034.

When generating X25519 (native) encryption for a VLESS inbound (mlkem768x25519plus.native.0rtt.<key>), the client QR code modal and link action suppressed the VLESS QR code because isPostQuantumLink was gating QR code display without considering physical QR capacity or defensive handling of query parameters.

Root Cause & Engineering Solution

  1. Physical QR Capacity Guard: Standard QR code encoding (Level L) can hold up to 2953 bytes. Any URL with length <= 1000 characters is guaranteed to fit easily in a scannable QR code and can never carry post-quantum key payloads (ML-KEM-768 is ~1580 bytes and ML-DSA-65 is ~2600 bytes). Added an early exit if (link.length <= 1000) return false;.
  2. Defensive pqv Parameter Check: Short flag parameters (e.g. pqv=1 or pqv=true) are not post-quantum verify keys. Only actual ML-DSA-65 verify key payloads (pqv.length > 300) trigger post-quantum suppression.
  3. Explicit Non-PQ Handling for X25519: If vlessEncryptionAuthKind resolves to any x25519* mode (native, xorpub, random), it explicitly returns false.

Verification

  • Tested with VLESS link carrying mlkem768x25519plus.native.0rtt.<x25519Key>: QR code displayed.
  • Tested with xorpub and random X25519 variants: QR code displayed.
  • Tested with real ML-KEM-768 (> 1500 chars) and ML-DSA-65 (> 2600 chars): QR code suppressed as intended.
  • Ran test suite vitest run --project unit src/test/inbound-link.test.ts: 82/82 tests passed.
  • Ran tsc --noEmit and oxlint: 0 errors, 0 warnings.

🔄 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/7049 **Author:** [@DoctorGuidance](https://github.com/DoctorGuidance) **Created:** 11/2/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/vless-x25519-qr-display` --- ### 📝 Commits (1) - [`6fbb63b`](https://github.com/MHSanaei/3x-ui/commit/6fbb63bfe20520f646e6414386ff6969262f5aac) fix(frontend): ensure QR code displays for X25519 VLESS links (#7034) ### 📊 Changes **2 files changed** (+41 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/xray/inbound-link.ts` (+15 -4) 📝 `frontend/src/test/inbound-link.test.ts` (+26 -0) </details> ### 📄 Description ### Summary of Changes Fixes #7034. When generating `X25519 (native)` encryption for a VLESS inbound (`mlkem768x25519plus.native.0rtt.<key>`), the client QR code modal and link action suppressed the VLESS QR code because `isPostQuantumLink` was gating QR code display without considering physical QR capacity or defensive handling of query parameters. ### Root Cause & Engineering Solution 1. **Physical QR Capacity Guard**: Standard QR code encoding (Level L) can hold up to 2953 bytes. Any URL with length <= 1000 characters is guaranteed to fit easily in a scannable QR code and can never carry post-quantum key payloads (ML-KEM-768 is ~1580 bytes and ML-DSA-65 is ~2600 bytes). Added an early exit `if (link.length <= 1000) return false;`. 2. **Defensive `pqv` Parameter Check**: Short flag parameters (e.g. `pqv=1` or `pqv=true`) are not post-quantum verify keys. Only actual ML-DSA-65 verify key payloads (`pqv.length > 300`) trigger post-quantum suppression. 3. **Explicit Non-PQ Handling for X25519**: If `vlessEncryptionAuthKind` resolves to any `x25519*` mode (`native`, `xorpub`, `random`), it explicitly returns `false`. ### Verification - Tested with VLESS link carrying `mlkem768x25519plus.native.0rtt.<x25519Key>`: QR code displayed. - Tested with `xorpub` and `random` X25519 variants: QR code displayed. - Tested with real ML-KEM-768 (> 1500 chars) and ML-DSA-65 (> 2600 chars): QR code suppressed as intended. - Ran test suite `vitest run --project unit src/test/inbound-link.test.ts`: 82/82 tests passed. - Ran `tsc --noEmit` and `oxlint`: 0 errors, 0 warnings. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:34:11 +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#6619
No description provided.