[PR #6628] [MERGED] fix(sub): make Happ require auth on its local SOCKS/HTTP proxy #6382

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6628
Author: @rudenko-ks
Created: 9/23/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @MHSanaei

Base: main ← Head: feat/happ-local-proxy-auth


📝 Commits (2)

  • a53e27f fix(sub): make Happ require auth on its local SOCKS/HTTP proxy
  • 6a47725 Merge branch 'main' into feat/happ-local-proxy-auth

📊 Changes

27 files changed (+162 additions, -0 deletions)

View changed files

📝 docs/public/openapi.json (+8 -0)
📝 frontend/public/openapi.json (+8 -0)
📝 frontend/src/generated/examples.ts (+2 -0)
📝 frontend/src/generated/schemas.ts (+8 -0)
📝 frontend/src/generated/types.ts (+2 -0)
📝 frontend/src/generated/zod.ts (+2 -0)
📝 frontend/src/models/setting.ts (+1 -0)
📝 frontend/src/pages/settings/HappSettingsContent.tsx (+17 -0)
📝 frontend/src/schemas/setting.ts (+1 -0)
📝 internal/sub/happ.go (+7 -0)
📝 internal/sub/happ_test.go (+34 -0)
📝 internal/sub/sub.go (+1 -0)
📝 internal/web/entity/entity.go (+1 -0)
📝 internal/web/service/setting.go (+5 -0)
📝 internal/web/translation/ar-EG.json (+5 -0)
📝 internal/web/translation/en-US.json (+5 -0)
📝 internal/web/translation/es-ES.json (+5 -0)
📝 internal/web/translation/fa-IR.json (+5 -0)
📝 internal/web/translation/id-ID.json (+5 -0)
📝 internal/web/translation/ja-JP.json (+5 -0)

...and 7 more files

📄 Description

Problem

Happ starts its local SOCKS5 (127.0.0.1:10808) and HTTP inbounds without authorization by default
(confirmed on Happ Android 4.4.1 and desktop 4.3.0: Settings → Inbounds → Authorization mode: Disable).
Any other app on the same device can connect to that proxy directly — bypassing Android's per-app VPN
routing — and learn the VPN server's address. This is the leak publicly described in March–April 2026 for
Happ, v2rayNG, Hiddify and other VLESS clients (Habr 1020080, xakep.ru 2026-04-07). Happ removed its exposed
Xray API (HandlerService) afterwards, but the unauthenticated local proxy remained (kod.ru, 2026-04-11).

Happ already lets a subscription fix this: socks-auth-mode / http-auth-mode = auto | manual | from-json | disable
are standard headers in Happ's app-management docs — no Provider ID required.

Change

  • New subscription setting subHappLocalProxyAuth (Settings → Subscription → Happ), values auto (default),
    disable, or empty (send nothing, keep the client's own setting).
  • ApplyHappHeaders sends both Socks-Auth-Mode and Http-Auth-Mode with that value.
  • Same gating as every other Happ header: only when Happ auto-detect is on and the User-Agent is Happ.
    Panels that never enabled the Happ integration see no change; non-Happ clients get nothing.
  • i18n for all 13 locales; generated types/schemas/OpenAPI via make gen.

Verification

  • Unit test TestApplyHappHeaders_LocalProxyAuth (table): Happ+auto → both headers auto; disable forwarded;
    empty → none; non-Happ UA → none; auto-detect off → none. Fails without the change.
  • On a real device (Happ Android 4.4.1, Xray 26.7.28, no Provider ID): a subscription carrying
    socks-auth-mode: manual + a test user/password switched Inbounds to Manual with exactly those
    credentials on "Refresh subscription"; auto switched it to Auto with generated credentials.

Notes

  • Why auto by default: the unsafe state is the client default; auto needs no admin input and Happ generates
    per-device random credentials, so nothing leaks and nothing has to be distributed.
  • Happ disables inbound authorization while Allow connections from the LAN is on (it warns about this in its UI);
    that is a client choice and out of scope here.

🤖 Generated with Claude Code


🔄 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/6628 **Author:** [@rudenko-ks](https://github.com/rudenko-ks) **Created:** 9/23/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/happ-local-proxy-auth` --- ### 📝 Commits (2) - [`a53e27f`](https://github.com/MHSanaei/3x-ui/commit/a53e27f14c1976cee01c9a2af8cd6a02e1aa78f1) fix(sub): make Happ require auth on its local SOCKS/HTTP proxy - [`6a47725`](https://github.com/MHSanaei/3x-ui/commit/6a47725c9ad1ec9e7feebf55e26ca8ced15ed06b) Merge branch 'main' into feat/happ-local-proxy-auth ### 📊 Changes **27 files changed** (+162 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/public/openapi.json` (+8 -0) 📝 `frontend/public/openapi.json` (+8 -0) 📝 `frontend/src/generated/examples.ts` (+2 -0) 📝 `frontend/src/generated/schemas.ts` (+8 -0) 📝 `frontend/src/generated/types.ts` (+2 -0) 📝 `frontend/src/generated/zod.ts` (+2 -0) 📝 `frontend/src/models/setting.ts` (+1 -0) 📝 `frontend/src/pages/settings/HappSettingsContent.tsx` (+17 -0) 📝 `frontend/src/schemas/setting.ts` (+1 -0) 📝 `internal/sub/happ.go` (+7 -0) 📝 `internal/sub/happ_test.go` (+34 -0) 📝 `internal/sub/sub.go` (+1 -0) 📝 `internal/web/entity/entity.go` (+1 -0) 📝 `internal/web/service/setting.go` (+5 -0) 📝 `internal/web/translation/ar-EG.json` (+5 -0) 📝 `internal/web/translation/en-US.json` (+5 -0) 📝 `internal/web/translation/es-ES.json` (+5 -0) 📝 `internal/web/translation/fa-IR.json` (+5 -0) 📝 `internal/web/translation/id-ID.json` (+5 -0) 📝 `internal/web/translation/ja-JP.json` (+5 -0) _...and 7 more files_ </details> ### 📄 Description ### Problem Happ starts its local SOCKS5 (`127.0.0.1:10808`) and HTTP inbounds **without authorization by default** (confirmed on Happ Android 4.4.1 and desktop 4.3.0: *Settings → Inbounds → Authorization mode: Disable*). Any other app on the same device can connect to that proxy directly — bypassing Android's per-app VPN routing — and learn the VPN server's address. This is the leak publicly described in March–April 2026 for Happ, v2rayNG, Hiddify and other VLESS clients (Habr 1020080, xakep.ru 2026-04-07). Happ removed its exposed Xray API (HandlerService) afterwards, but the unauthenticated local proxy remained (kod.ru, 2026-04-11). Happ already lets a subscription fix this: `socks-auth-mode` / `http-auth-mode` = `auto | manual | from-json | disable` are **standard** headers in Happ's app-management docs — no Provider ID required. ### Change - New subscription setting `subHappLocalProxyAuth` (Settings → Subscription → Happ), values `auto` (default), `disable`, or empty (send nothing, keep the client's own setting). - `ApplyHappHeaders` sends both `Socks-Auth-Mode` and `Http-Auth-Mode` with that value. - Same gating as every other Happ header: only when **Happ auto-detect** is on and the User-Agent is Happ. Panels that never enabled the Happ integration see no change; non-Happ clients get nothing. - i18n for all 13 locales; generated types/schemas/OpenAPI via `make gen`. ### Verification - Unit test `TestApplyHappHeaders_LocalProxyAuth` (table): Happ+auto → both headers `auto`; `disable` forwarded; empty → none; non-Happ UA → none; auto-detect off → none. Fails without the change. - On a real device (Happ Android 4.4.1, Xray 26.7.28, no Provider ID): a subscription carrying `socks-auth-mode: manual` + a test user/password switched *Inbounds* to **Manual** with exactly those credentials on "Refresh subscription"; `auto` switched it to **Auto** with generated credentials. ### Notes - Why `auto` by default: the unsafe state is the client default; `auto` needs no admin input and Happ generates per-device random credentials, so nothing leaks and nothing has to be distributed. - Happ disables inbound authorization while *Allow connections from the LAN* is on (it warns about this in its UI); that is a client choice and out of scope here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:23 +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#6382
No description provided.