[PR #6538] [MERGED] fix(sub): prevent default profile page URL disclosure #6338

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6538
Author: @NgaiYeanCoi
Created: 9/15/2026
Status: ✅ Merged
Merged: 9/15/2026
Merged by: @MHSanaei

Base: main ← Head: fix/happ-profile-url-leak


📝 Commits (3)

  • ba32cd2 fix(sub): prevent default profile page URL disclosure
  • e734262 fix(subscription): add profile page link options and upgrade notes
  • a5ea8f3 Merge branch 'main' into fix/happ-profile-url-leak

📊 Changes

36 files changed (+747 additions, -47 deletions)

View changed files

📝 docs/content/docs/en/config/subscription.mdx (+19 -0)
📝 docs/content/docs/fa/config/subscription.mdx (+17 -0)
📝 docs/content/docs/ru/config/subscription.mdx (+18 -0)
📝 docs/content/docs/zh/config/subscription.mdx (+12 -0)
📝 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 (+11 -0)
📝 frontend/src/pages/settings/SubscriptionGeneralTab.tsx (+37 -8)
📝 frontend/src/schemas/setting.ts (+4 -0)
➕ frontend/src/test/setting-profile-mode.test.ts (+36 -0)
📝 frontend/src/test/subscription-general-tab.test.tsx (+74 -1)
📝 internal/sub/controller.go (+16 -6)
📝 internal/sub/placeholders.go (+12 -8)
📝 internal/sub/placeholders_test.go (+72 -11)
➕ internal/sub/profile_mode_test.go (+97 -0)
📝 internal/sub/sub.go (+5 -0)

...and 16 more files

📄 Description

Summary

Add explicit profile page modes: No link (default), Built-in subscription page, and Custom website. Preserve existing custom URLs during upgrades and when switching modes.

Why

Currently, an empty profile URL previously fell back to the subscription request URL in Profile-Web-Page-Url. This exposed a route to plaintext subscription URLs and node configurations, including for subscriptions imported through Happ encrypted links. It would violate Happ encrypt generator implemented original purpose.
The built-in page remains available through an explicit selection, with a warning explaining what it exposes. These settings apply to all subscription clients.

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?

go test -p 1 ./internal/sub ./internal/web/service -count=1
golangci-lint run ./internal/sub ./internal/web/service --concurrency 2
go build ./...
make verify

cd frontend
npm test -- --project=unit --project=components src/test/setting-profile-mode.test.ts src/test/subscription-general-tab.test.tsx src/test/i18n-dead-keys.test.ts
npm run typecheck
npm run lint
npm run build

Screenshots / recordings

image image image

Breaking changes

Previously empty profile URL settings now omit the website link instead of automatically exposing the built-in subscription page.
To restore the previous feature, select Built-in subscription page in subscription settings. Existing nonempty custom URLs remain active. An empty custom URL sends no link.
No database schema migration is required.

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 test suite pass locally.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed.
  • 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/6538 **Author:** [@NgaiYeanCoi](https://github.com/NgaiYeanCoi) **Created:** 9/15/2026 **Status:** ✅ Merged **Merged:** 9/15/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/happ-profile-url-leak` --- ### 📝 Commits (3) - [`ba32cd2`](https://github.com/MHSanaei/3x-ui/commit/ba32cd26f0e28a65882f32fa470221d1ca37650a) fix(sub): prevent default profile page URL disclosure - [`e734262`](https://github.com/MHSanaei/3x-ui/commit/e734262881c02d5d31c896a359e5af26d4a48198) fix(subscription): add profile page link options and upgrade notes - [`a5ea8f3`](https://github.com/MHSanaei/3x-ui/commit/a5ea8f349852fab7f25321959bf997fde3a4ee68) Merge branch 'main' into fix/happ-profile-url-leak ### 📊 Changes **36 files changed** (+747 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/en/config/subscription.mdx` (+19 -0) 📝 `docs/content/docs/fa/config/subscription.mdx` (+17 -0) 📝 `docs/content/docs/ru/config/subscription.mdx` (+18 -0) 📝 `docs/content/docs/zh/config/subscription.mdx` (+12 -0) 📝 `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` (+11 -0) 📝 `frontend/src/pages/settings/SubscriptionGeneralTab.tsx` (+37 -8) 📝 `frontend/src/schemas/setting.ts` (+4 -0) ➕ `frontend/src/test/setting-profile-mode.test.ts` (+36 -0) 📝 `frontend/src/test/subscription-general-tab.test.tsx` (+74 -1) 📝 `internal/sub/controller.go` (+16 -6) 📝 `internal/sub/placeholders.go` (+12 -8) 📝 `internal/sub/placeholders_test.go` (+72 -11) ➕ `internal/sub/profile_mode_test.go` (+97 -0) 📝 `internal/sub/sub.go` (+5 -0) _...and 16 more files_ </details> ### 📄 Description ## Summary Add explicit profile page modes: **No link** (default), **Built-in subscription page**, and **Custom website**. Preserve existing custom URLs during upgrades and when switching modes. <!-- What does this PR do? One or two sentences. --> ## Why Currently, an empty profile URL previously fell back to the subscription request URL in `Profile-Web-Page-Url`. This exposed a route to plaintext subscription URLs and node configurations, including for subscriptions imported through Happ encrypted links. It would violate Happ encrypt generator implemented original purpose. The built-in page remains available through an explicit selection, with a warning explaining what it exposes. These settings apply to all subscription clients. <!-- What problem does this solve, or what use case does it enable? Link related issues here: "Closes #123", "Refs #456". --> ## Type of change - [X] Bug fix - [X] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [X] Frontend (UI / panel pages) - [X] 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? ```bash go test -p 1 ./internal/sub ./internal/web/service -count=1 golangci-lint run ./internal/sub ./internal/web/service --concurrency 2 go build ./... make verify cd frontend npm test -- --project=unit --project=components src/test/setting-profile-mode.test.ts src/test/subscription-general-tab.test.tsx src/test/i18n-dead-keys.test.ts npm run typecheck npm run lint npm run build ``` <!-- Concrete steps the reviewer can repeat. For UI changes: which page, which actions, which browser. For backend: which endpoint, which payload, which response. Mention any new unit/integration tests added. --> ## Screenshots / recordings <!-- Required for UI changes. Drag images or GIFs here. Remove if N/A. --> <img width="1798" height="645" alt="image" src="https://github.com/user-attachments/assets/0a3de529-8ab3-4ec2-8a75-5e7ae9b84f9e" /> <img width="1782" height="553" alt="image" src="https://github.com/user-attachments/assets/f8298d44-69d1-4767-953d-a11afa9a30c3" /> <img width="1765" height="523" alt="image" src="https://github.com/user-attachments/assets/d60d2bb9-7b51-4dbe-b88d-c7c64b5a2752" /> ## Breaking changes Previously empty profile URL settings now omit the website link instead of automatically exposing the built-in subscription page. To restore the previous feature, select **Built-in subscription page** in subscription settings. Existing nonempty custom URLs remain active. An empty custom URL sends no link. No database schema migration is required. <!-- Does this change require existing users to update their config, run a migration, or change their API calls? If yes, describe the migration path. Write "None" if there are no breaking changes. --> ## 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 test suite pass locally. - [X] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [X] I updated the Wiki / README / API docs if user-facing behavior changed. - [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:03 +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#6338
No description provided.