[PR #6268] [MERGED] fix: reject Hysteria inbound updates with empty client auth #6205

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6268
Author: @mvanhorn
Created: 8/19/2026
Status: ✅ Merged
Merged: 8/22/2026
Merged by: @MHSanaei

Base: main ← Head: fix/6232-hysteria-update-auth-validation


📝 Commits (1)

  • 45a46d8 fix: reject Hysteria inbound updates with empty client auth

📊 Changes

2 files changed (+118 additions, -0 deletions)

View changed files

📝 internal/web/service/inbound.go (+12 -0)
➕ internal/web/service/inbound_hysteria_auth_test.go (+106 -0)

📄 Description

Summary

Parse the clients from the pending inbound settings in UpdateInbound and apply the existing Hysteria credential invariant before entering the persistence transaction, mirroring the rejection behavior already enforced by AddInbound. Return the established empty client ID validation error when any Hysteria client has an empty auth, so an API-driven protocol change or edit cannot reach SyncInbound or the runtime with unusable credentials. Keep valid Hysteria auth values unchanged and do not synthesize them from password, mutate unrelated credentials, or add a database migration.

Hysteria clients authenticate with their dedicated auth credential, but UpdateInbound can currently persist a Hysteria settings payload whose client has an empty auth. That row is later rendered into the Xray configuration without a usable credential, producing authentication failures. Creation and client-specific write paths already prevent or fill this state, leaving the whole-inbound update path as the concrete gap. The fix must preserve the intentional separation between Hysteria auth and the Trojan/Shadowsocks password field rather than copying one into the other.

Closes #6232

Why

Parse the clients from the pending inbound settings in UpdateInbound and apply the existing Hysteria credential invariant before entering the persistence transaction, mirroring the rejection behavior already enforced by AddInbound. Return the established empty client ID validation error when any Hysteria client has an empty auth, so an API-driven protocol change or edit cannot reach SyncInbound or the runtime with unusable credentials. Keep valid Hysteria auth values unchanged and do not synthesize them from password, mutate unrelated credentials, or add a database migration.

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?

Not applicable to this change.

Screenshots / recordings

No user-visible surface changes in this PR, so there is nothing to show.

Breaking changes

None. This change is additive and does not alter an existing public interface or stored format.

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.

AI disclosure

AI was used for assistance.

  • Tools: an AI coding assistant.

🔄 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/6268 **Author:** [@mvanhorn](https://github.com/mvanhorn) **Created:** 8/19/2026 **Status:** ✅ Merged **Merged:** 8/22/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/6232-hysteria-update-auth-validation` --- ### 📝 Commits (1) - [`45a46d8`](https://github.com/MHSanaei/3x-ui/commit/45a46d879d34282d14da6ac098a954a0590c7cc0) fix: reject Hysteria inbound updates with empty client auth ### 📊 Changes **2 files changed** (+118 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `internal/web/service/inbound.go` (+12 -0) ➕ `internal/web/service/inbound_hysteria_auth_test.go` (+106 -0) </details> ### 📄 Description ## Summary Parse the clients from the pending inbound settings in `UpdateInbound` and apply the existing Hysteria credential invariant before entering the persistence transaction, mirroring the rejection behavior already enforced by `AddInbound`. Return the established `empty client ID` validation error when any Hysteria client has an empty `auth`, so an API-driven protocol change or edit cannot reach `SyncInbound` or the runtime with unusable credentials. Keep valid Hysteria auth values unchanged and do not synthesize them from `password`, mutate unrelated credentials, or add a database migration. Hysteria clients authenticate with their dedicated `auth` credential, but `UpdateInbound` can currently persist a Hysteria settings payload whose client has an empty `auth`. That row is later rendered into the Xray configuration without a usable credential, producing authentication failures. Creation and client-specific write paths already prevent or fill this state, leaving the whole-inbound update path as the concrete gap. The fix must preserve the intentional separation between Hysteria `auth` and the Trojan/Shadowsocks `password` field rather than copying one into the other. Closes #6232 ## Why Parse the clients from the pending inbound settings in `UpdateInbound` and apply the existing Hysteria credential invariant before entering the persistence transaction, mirroring the rejection behavior already enforced by `AddInbound`. Return the established `empty client ID` validation error when any Hysteria client has an empty `auth`, so an API-driven protocol change or edit cannot reach `SyncInbound` or the runtime with unusable credentials. Keep valid Hysteria auth values unchanged and do not synthesize them from `password`, mutate unrelated credentials, or add a database migration. ## 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 - [ ] 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? Not applicable to this change. ## Screenshots / recordings No user-visible surface changes in this PR, so there is nothing to show. ## Breaking changes None. This change is additive and does not alter an existing public interface or stored format. ## 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. - [ ] I have no unrelated changes mixed into this PR. **AI disclosure** AI was used for assistance. - Tools: an AI coding assistant. --- <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:05 +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#6205
No description provided.