[GH-ISSUE #6444] [Bug]: HostFormModal hides Fingerprint when Security is "same", preserving stale override and breaking inbound inheritance #4365

Closed
opened 2026-10-31 20:39:08 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @TheMRVX on GitHub (Sep 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6444

Describe the bug

In the Host modal (frontend/src/pages/hosts/HostFormModal.tsx), setting Security to "same" completely hides the Fingerprint field because showTls evaluates to false.

However:

  1. Changing Security to "same" does not clear any previously selected fingerprint in the form state or database (hosts.fingerprint).
  2. The user has no UI affordance to view, edit, or clear the fingerprint while Security is "same".
  3. The backend subscription generator (internal/sub/host_sub.go:71) checks if h.Fingerprint != "" and applies ep["fingerprint"] = h.Fingerprint, overriding the inbound's fingerprint.

As a result, if a host previously had a fingerprint set (such as edge or ios), and the user changes Security to "same" intending to inherit the inbound's new fingerprint (such as firefox or chrome), the stale fingerprint persists indefinitely in the database and is emitted in all client subscription links. On modern Xray-core versions (e.g. v26.9.9+ with REALITY post-quantum strict key exchange), this causes complete connection failure.

How to reproduce the problem

  1. Create a VLESS + REALITY inbound with Fingerprint set to firefox.
  2. Go to the Hosts page and create or edit a host for this inbound.
  3. Temporarily set Security to reality and select Fingerprint: edge (or edit a pre-existing host that had edge). Save the host.
  4. Edit the host again: switch Security from reality to same. Notice that the Fingerprint field completely disappears from the modal.
  5. Click Save.
  6. Inspect the database (SELECT fingerprint FROM hosts ...) or fetch the subscription link (/sub/<sub_id>).
  7. Result: The subscription link outputs &fp=edge instead of inheriting &fp=firefox from the inbound.

Expected behavior

When Security is set to "same", users should be able to:

  1. Keep the Fingerprint field visible with an allowClear dropdown so they can optionally override or clear it to inherit the inbound's fingerprint.
  2. Alternatively, switching to "same" should reset or allow unsetting fingerprint so stale values are not trapped in the database.

Actual behavior

The Fingerprint input is unmounted/hidden, preventing the user from clearing or changing it, while the database keeps the stale value and overrides the inbound link.

Relevant logs & Code inspection

Excerpt from 3xui.log:

DEBUG - Subscription request routed: branch=raw user_agent="v2rayNG/2.2.6"

(Subscription link emits stale &fp=edge parameter generated from hosts.fingerprint despite inbound being set to firefox).

Root cause in frontend (frontend/src/pages/hosts/HostFormModal.tsx:94):

const security = (useWatch({ control: methods.control, name: 'security' }) ?? 'same') as string;
const showTls = security === 'tls' || security === 'reality';
const showTlsExtras = security === 'tls';

When security === 'same', showTls is false, causing lines 302–325 (containing the Fingerprint FormField) not to render:

{showTls && (
  <>
    <FormField name="sni" ... />
    ...
    <FormField name="fingerprint" label={t('pages.hosts.fields.fingerprint')}>
      <Select allowClear options={fpOptions} />
    </FormField>
  </>
)}

Backend inheritance in internal/sub/host_sub.go:71-73:

if h.Fingerprint != "" {
    ep["fingerprint"] = h.Fingerprint
}

Because the database still has h.Fingerprint = "edge", it overrides the inbound's firefox.

Environment Details (Mandatory per CONTRIBUTING.md#issues)

  • 3x-ui version: 3.7.0 (v3.7.0)
  • Go version: go1.27.1 linux/amd64
  • Operating system: Ubuntu 24.04.4 LTS
  • Xray-core version: v26.9.9
  • Install method: install.sh script
  • Affected parts: Frontend (UI / panel pages), Subscription (share links / Clash / JSON)
  • Browser: Chrome / Firefox (all modern browsers)
  • Database: PostgreSQL / SQLite
Originally created by @TheMRVX on GitHub (Sep 10, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6444 ### Describe the bug In the Host modal (`frontend/src/pages/hosts/HostFormModal.tsx`), setting **Security** to `"same"` completely hides the **Fingerprint** field because `showTls` evaluates to `false`. However: 1. Changing Security to `"same"` does not clear any previously selected fingerprint in the form state or database (`hosts.fingerprint`). 2. The user has no UI affordance to view, edit, or clear the fingerprint while Security is `"same"`. 3. The backend subscription generator (`internal/sub/host_sub.go:71`) checks `if h.Fingerprint != ""` and applies `ep["fingerprint"] = h.Fingerprint`, overriding the inbound's fingerprint. As a result, if a host previously had a fingerprint set (such as `edge` or `ios`), and the user changes Security to `"same"` intending to inherit the inbound's new fingerprint (such as `firefox` or `chrome`), the stale fingerprint persists indefinitely in the database and is emitted in all client subscription links. On modern Xray-core versions (e.g. v26.9.9+ with REALITY post-quantum strict key exchange), this causes complete connection failure. ### How to reproduce the problem 1. Create a VLESS + REALITY inbound with Fingerprint set to `firefox`. 2. Go to the **Hosts** page and create or edit a host for this inbound. 3. Temporarily set Security to `reality` and select Fingerprint: `edge` (or edit a pre-existing host that had `edge`). Save the host. 4. Edit the host again: switch Security from `reality` to `same`. Notice that the **Fingerprint** field completely disappears from the modal. 5. Click **Save**. 6. Inspect the database (`SELECT fingerprint FROM hosts ...`) or fetch the subscription link (`/sub/<sub_id>`). 7. **Result**: The subscription link outputs `&fp=edge` instead of inheriting `&fp=firefox` from the inbound. ### Expected behavior When Security is set to `"same"`, users should be able to: 1. Keep the Fingerprint field visible with an `allowClear` dropdown so they can optionally override or clear it to inherit the inbound's fingerprint. 2. Alternatively, switching to `"same"` should reset or allow unsetting `fingerprint` so stale values are not trapped in the database. ### Actual behavior The Fingerprint input is unmounted/hidden, preventing the user from clearing or changing it, while the database keeps the stale value and overrides the inbound link. ### Relevant logs & Code inspection **Excerpt from `3xui.log`:** ```log DEBUG - Subscription request routed: branch=raw user_agent="v2rayNG/2.2.6" ``` *(Subscription link emits stale `&fp=edge` parameter generated from `hosts.fingerprint` despite inbound being set to `firefox`).* **Root cause in frontend (`frontend/src/pages/hosts/HostFormModal.tsx:94`):** ```tsx const security = (useWatch({ control: methods.control, name: 'security' }) ?? 'same') as string; const showTls = security === 'tls' || security === 'reality'; const showTlsExtras = security === 'tls'; ``` When `security === 'same'`, `showTls` is `false`, causing lines 302–325 (containing the Fingerprint FormField) not to render: ```tsx {showTls && ( <> <FormField name="sni" ... /> ... <FormField name="fingerprint" label={t('pages.hosts.fields.fingerprint')}> <Select allowClear options={fpOptions} /> </FormField> </> )} ``` **Backend inheritance in `internal/sub/host_sub.go:71-73`:** ```go if h.Fingerprint != "" { ep["fingerprint"] = h.Fingerprint } ``` Because the database still has `h.Fingerprint = "edge"`, it overrides the inbound's `firefox`. ### Environment Details (Mandatory per CONTRIBUTING.md#issues) - **3x-ui version**: 3.7.0 (v3.7.0) - **Go version**: go1.27.1 linux/amd64 - **Operating system**: Ubuntu 24.04.4 LTS - **Xray-core version**: v26.9.9 - **Install method**: install.sh script - **Affected parts**: Frontend (UI / panel pages), Subscription (share links / Clash / JSON) - **Browser**: Chrome / Firefox (all modern browsers) - **Database**: PostgreSQL / SQLite
Author
Owner

@github-actions[bot] commented on GitHub (Sep 10, 2026):

Confirmed — all three of your mechanical claims hold on the current default branch (v3.7.0 is the latest release, so you are already at the tip). It is a frontend defect: a host's TLS override fields stay live when Security is same, but the modal only renders them for tls/reality, so a previously-set fingerprint becomes unreachable while it keeps being emitted.

Workaround — no database access needed

The form store keeps the values of unmounted fields, so you can clear the fingerprint from the UI by briefly re-showing it:

  1. Edit the host → Security tab.
  2. Set Security to tls (or reality). The Fingerprint field reappears, still holding edge.
  3. Pick None in the Fingerprint dropdown (or click its clear ×).
  4. Set Security back to same.
  5. Save. The subscription link then inherits the inbound's fp again.

Step 4 does not undo step 3 because useForm in this modal (frontend/src/pages/hosts/HostFormModal.tsx:89) does not set shouldUnregister, so React Hook Form's default false applies, and UpdateHostGroup rewrites the rows rather than patching them, so an empty fingerprint really does persist.

Evidence

1 — the field is unreachable under same (frontend/src/pages/hosts/HostFormModal.tsx):

:94   const showTls = security === 'tls' || security === 'reality';
:306  {showTls && (
:325    <FormField name="fingerprint" label={t('pages.hosts.fields.fingerprint')}>
:326      <Select allowClear options={fpOptions} />

name="fingerprint" occurs exactly once in the file, so there is no second affordance.

2 — the stale value is still submitted. onFinish (HostFormModal.tsx:155-163) spreads the entire form store into the payload and never runs it through BulkAddHostSchema, so fingerprint: "edge" goes on the wire. That the codebase deliberately relies on shouldUnregister: false retaining unbound sub-trees is stated at frontend/src/pages/inbounds/form/InboundFormModal.tsx:558-561.

3 — the backend stores it verbatim. internal/web/service/host.go:135 is Fingerprint: req.Fingerprint, and UpdateHostGroup (internal/web/service/host.go:247-273) deletes the group and re-creates the rows. Nothing normalises Fingerprint against req.Security.

4 — it still reaches the link under same. internal/sub/host_sub.go:71-72:

if h.Fingerprint != "" {
    ep["fingerprint"] = h.Fingerprint
}

hostSecurityToForceTls (internal/sub/host_sub.go:176-183) maps "same" → "same"; internal/sub/endpoint.go:98-101 then keeps the inbound's security:

securityToApply := baseSecurity
if e.ForceTls != "same" {
    securityToApply = e.ForceTls
}

so with a REALITY inbound securityToApply == "reality" and applyEndpointRealityParams (internal/sub/host_sub.go:305-307) runs params["fp"] = fp. Your &fp=edge is exactly that line.

Scope is wider than Fingerprint

The same showTls gate also hides sni, overrideSniFromAddress and keepSniBlank (HostFormModal.tsx:308-324), and showTlsExtras hides alpn, pinnedPeerCertSha256, verifyPeerCertByName, allowInsecure and echConfigList (HostFormModal.tsx:330-360). Under Security same over a TLS inbound a stale sni is trapped and applied the same way, via applyExternalProxyTLSParams (internal/sub/service.go:1890). Worth addressing in one pass rather than for fingerprint alone.

What is not a bug

The backend override itself is intended, not accidental. TestSub_HostRealitySniOverride (internal/sub/host_sub_test.go:369-395) pins it: a host's sni + fp win over the inbound's while pbk/sid are inherited. So this belongs in the modal's render gate, not in internal/sub/host_sub.go.


Verdict: Confirmed bug
Severity: Medium — a UI-only trap on a specific edit sequence (host had a fingerprint, then Security switched to same), with a full in-panel workaround
Confidence: High for the mechanism; every step is cited below. Medium for your stated consequence (see Not determined)
Root cause: frontend/src/pages/hosts/HostFormModal.tsx:94 — showTls excludes 'same', so the render gate at :306 unmounts the Fingerprint/SNI fields while their values remain in the RHF store (useForm at :89, no shouldUnregister) and are submitted by onFinish (:155-163) without schema normalisation. Trigger: an existing host with a non-empty fingerprint (or sni) whose Security is changed to same over a tls/reality inbound. Introduced by 709b332d feat(hosts): managed Hosts for per-host subscription link overrides (#5409), which added the showTls line with the field set it gates.
Already fixed: Still present on the default branch (git log -S "const showTls = security" -- frontend/src/pages/hosts/HostFormModal.tsx returns only 709b332d)
Duplicate of: None. gh issue list --search "hosts security same" --state all and gh search prs --repo MHSanaei/3x-ui "host fingerprint" --merged surfaced no report or merged fix for this path
Evidence: HostFormModal.tsx:94, :306, :325-327, :155-163, :89; InboundFormModal.tsx:558-561 (the shouldUnregister: false reliance); internal/web/service/host.go:135, :247-273; internal/sub/host_sub.go:71-72, :176-183, :305-307; internal/sub/endpoint.go:98-101; internal/sub/service.go:1890; internal/sub/host_sub_test.go:369-395 (pins the override as intended)
Not determined: Whether fp=edge on its own causes a total handshake failure on Xray-core v26.9.9 REALITY, as opposed to a degraded/fingerprintable one. The panel's pqv param maps to mldsa65Verify at internal/util/link/outbound.go:677 — the ML-DSA-65 signature, not the ML-KEM key exchange you describe — so the failure mode is Xray-core client behaviour I cannot exercise here. It does not affect the verdict. A client log from Xray with fp=edge versus fp=firefox against the same inbound would settle it.

Suggested fix: Keep the Security tab's override fields reachable when Security is same, since they are live in that mode — i.e. widen the showTls/showTlsExtras predicates at HostFormModal.tsx:94-95 rather than adding clearing logic. Fingerprint and SNI already have a clear affordance (allowClear, and the '' = None option built at :132-139), so exposure alone restores the escape hatch.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5613403559 --> @github-actions[bot] commented on GitHub (Sep 10, 2026): Confirmed — all three of your mechanical claims hold on the current default branch (v3.7.0 is the latest release, so you are already at the tip). It is a **frontend** defect: a host's TLS override fields stay *live* when Security is `same`, but the modal only renders them for `tls`/`reality`, so a previously-set fingerprint becomes unreachable while it keeps being emitted. ### Workaround — no database access needed The form store keeps the values of unmounted fields, so you can clear the fingerprint from the UI by briefly re-showing it: 1. Edit the host → **Security** tab. 2. Set **Security** to `tls` (or `reality`). The **Fingerprint** field reappears, still holding `edge`. 3. Pick **None** in the Fingerprint dropdown (or click its clear `×`). 4. Set **Security** back to `same`. 5. **Save**. The subscription link then inherits the inbound's `fp` again. Step 4 does not undo step 3 because `useForm` in this modal (`frontend/src/pages/hosts/HostFormModal.tsx:89`) does not set `shouldUnregister`, so React Hook Form's default `false` applies, and `UpdateHostGroup` rewrites the rows rather than patching them, so an empty fingerprint really does persist. ### Evidence **1 — the field is unreachable under `same`** (`frontend/src/pages/hosts/HostFormModal.tsx`): ```tsx :94 const showTls = security === 'tls' || security === 'reality'; :306 {showTls && ( :325 <FormField name="fingerprint" label={t('pages.hosts.fields.fingerprint')}> :326 <Select allowClear options={fpOptions} /> ``` `name="fingerprint"` occurs exactly once in the file, so there is no second affordance. **2 — the stale value is still submitted.** `onFinish` (`HostFormModal.tsx:155-163`) spreads the entire form store into the payload and never runs it through `BulkAddHostSchema`, so `fingerprint: "edge"` goes on the wire. That the codebase deliberately relies on `shouldUnregister: false` retaining unbound sub-trees is stated at `frontend/src/pages/inbounds/form/InboundFormModal.tsx:558-561`. **3 — the backend stores it verbatim.** `internal/web/service/host.go:135` is `Fingerprint: req.Fingerprint`, and `UpdateHostGroup` (`internal/web/service/host.go:247-273`) deletes the group and re-creates the rows. Nothing normalises `Fingerprint` against `req.Security`. **4 — it still reaches the link under `same`.** `internal/sub/host_sub.go:71-72`: ```go if h.Fingerprint != "" { ep["fingerprint"] = h.Fingerprint } ``` `hostSecurityToForceTls` (`internal/sub/host_sub.go:176-183`) maps `"same"` → `"same"`; `internal/sub/endpoint.go:98-101` then keeps the inbound's security: ```go securityToApply := baseSecurity if e.ForceTls != "same" { securityToApply = e.ForceTls } ``` so with a REALITY inbound `securityToApply == "reality"` and `applyEndpointRealityParams` (`internal/sub/host_sub.go:305-307`) runs `params["fp"] = fp`. Your `&fp=edge` is exactly that line. ### Scope is wider than Fingerprint The same `showTls` gate also hides `sni`, `overrideSniFromAddress` and `keepSniBlank` (`HostFormModal.tsx:308-324`), and `showTlsExtras` hides `alpn`, `pinnedPeerCertSha256`, `verifyPeerCertByName`, `allowInsecure` and `echConfigList` (`HostFormModal.tsx:330-360`). Under Security `same` over a **TLS** inbound a stale `sni` is trapped and applied the same way, via `applyExternalProxyTLSParams` (`internal/sub/service.go:1890`). Worth addressing in one pass rather than for `fingerprint` alone. ### What is *not* a bug The backend override itself is intended, not accidental. `TestSub_HostRealitySniOverride` (`internal/sub/host_sub_test.go:369-395`) pins it: a host's `sni` + `fp` win over the inbound's while `pbk`/`sid` are inherited. So this belongs in the modal's render gate, not in `internal/sub/host_sub.go`. --- Verdict: Confirmed bug Severity: Medium — a UI-only trap on a specific edit sequence (host had a fingerprint, then Security switched to `same`), with a full in-panel workaround Confidence: High for the mechanism; every step is cited below. Medium for your stated consequence (see Not determined) Root cause: `frontend/src/pages/hosts/HostFormModal.tsx:94` — `showTls` excludes `'same'`, so the render gate at `:306` unmounts the Fingerprint/SNI fields while their values remain in the RHF store (`useForm` at `:89`, no `shouldUnregister`) and are submitted by `onFinish` (`:155-163`) without schema normalisation. Trigger: an existing host with a non-empty `fingerprint` (or `sni`) whose Security is changed to `same` over a `tls`/`reality` inbound. Introduced by 709b332d `feat(hosts): managed Hosts for per-host subscription link overrides (#5409)`, which added the `showTls` line with the field set it gates. Already fixed: Still present on the default branch (`git log -S "const showTls = security" -- frontend/src/pages/hosts/HostFormModal.tsx` returns only 709b332d) Duplicate of: None. `gh issue list --search "hosts security same" --state all` and `gh search prs --repo MHSanaei/3x-ui "host fingerprint" --merged` surfaced no report or merged fix for this path Evidence: `HostFormModal.tsx:94`, `:306`, `:325-327`, `:155-163`, `:89`; `InboundFormModal.tsx:558-561` (the `shouldUnregister: false` reliance); `internal/web/service/host.go:135`, `:247-273`; `internal/sub/host_sub.go:71-72`, `:176-183`, `:305-307`; `internal/sub/endpoint.go:98-101`; `internal/sub/service.go:1890`; `internal/sub/host_sub_test.go:369-395` (pins the override as intended) Not determined: Whether `fp=edge` on its own causes a *total* handshake failure on Xray-core v26.9.9 REALITY, as opposed to a degraded/fingerprintable one. The panel's `pqv` param maps to `mldsa65Verify` at `internal/util/link/outbound.go:677` — the ML-DSA-65 signature, not the ML-KEM key exchange you describe — so the failure mode is Xray-core client behaviour I cannot exercise here. It does not affect the verdict. A client log from Xray with `fp=edge` versus `fp=firefox` against the same inbound would settle it. Suggested fix: Keep the Security tab's override fields reachable when Security is `same`, since they are live in that mode — i.e. widen the `showTls`/`showTlsExtras` predicates at `HostFormModal.tsx:94-95` rather than adding clearing logic. Fingerprint and SNI already have a clear affordance (`allowClear`, and the `''` = None option built at `:132-139`), so exposure alone restores the escape hatch. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4365
No description provided.