[GH-ISSUE #5499] [Bug]: Tunnel inbound sockopt change fails: missing field streamSettings.security #3838

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

Originally created by @DenMaxRus on GitHub (Jun 23, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5499

Describe the bug

When trying to set sockopt settings for tunnel inbound I am getting error on save action streamSettings.security — Invalid input. security field is missing in final json. If security: "none" is manually added via json, save completes, but nothing really changes, sockopt doesn't change. Xray docs say "none" means disabled (default). so it feels like unnecessary check for this field on panel side.

How to reproduce the problem

  1. Open tunnel inbound settings
  2. Got to Stream settings tab
  3. Enable sockopts toggle
  4. Click Save

Expected behavior

sockopt params added for tunnel inbound

Actual behavior

Error popup streamSettings.security — Invalid input
OR
Sockopt changes doesn't save when security field is manually added

Relevant logs


Screenshots

Image

3x-ui version

3.3.1

Xray-core version

26.6.1,26.6.22

How did you install 3x-ui?

Docker / Docker Compose

Operating system

Ubintu 24.04

Which parts of the panel are affected?

Xray config generation

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

Yes — Nginx

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @DenMaxRus on GitHub (Jun 23, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5499 ### Describe the bug When trying to set `sockopt` settings for tunnel inbound I am getting error on save action `streamSettings.security — Invalid input`. `security` field is missing in final json. If `security: "none"` is manually added via json, save completes, but nothing really changes, `sockopt` doesn't change. [Xray docs say](https://xtls.github.io/en/config/transport.html) `"none" means disabled (default).` so it feels like unnecessary check for this field on panel side. ### How to reproduce the problem 1. Open tunnel inbound settings 2. Got to `Stream` settings tab 3. Enable sockopts toggle 4. Click `Save` ### Expected behavior `sockopt` params added for tunnel inbound ### Actual behavior Error popup `streamSettings.security — Invalid input` OR Sockopt changes doesn't save when `security` field is manually added ### Relevant logs ```shell ``` ### Screenshots <img width="957" height="796" alt="Image" src="https://github.com/user-attachments/assets/39579b13-fc5b-4861-9081-5a8ef132c37b" /> ### 3x-ui version 3.3.1 ### Xray-core version 26.6.1,26.6.22 ### How did you install 3x-ui? Docker / Docker Compose ### Operating system Ubintu 24.04 ### Which parts of the panel are affected? Xray config generation ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? Yes — Nginx ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:35:19 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 23, 2026):

Two distinct bugs are at play here, both confirmed in the source and both already fixed on main.

Bug 1 — Frontend validation: streamSettings.security — Invalid input

SecuritySettingsSchema in frontend/src/schemas/protocols/security/index.ts is a Zod discriminated union keyed on security. In v3.3.1 it only accepted the values 'none', 'tls', and 'reality'; any streamSettings object where the security key was absent (which can happen in the tunnel form path) failed validation with the reported error. The fix — adding a second union branch z.object({ security: z.never().optional() }) to handle transportless protocols like tunnel/dokodemo-door — was shipped in the commit that closed #5339 (fix(frontend): TProxy schema, VLESS+XHTTP flow links, clearable Jalali date picker).

Bug 2 — Backend normalization silently wipes streamSettings for tunnel

normalizeStreamSettings() in internal/web/service/inbound.go clears inbound.StreamSettings for any protocol not in a hardcoded whitelist. In v3.3.1, tunnel (dokodemo-door) was absent from that whitelist, so the backend discarded the entire streamSettings — including sockopt — on every add and update call. This is why manually inserting "security": "none" in the JSON editor allowed the save to pass frontend validation, but the sockopt changes still did not persist. The fix adds model.Tunnel: true to the whitelist and was committed as fix(inbound): persist streamSettings for tunnel so sockopt saves.

Status

Both commits are on main (confirmed as ancestors of a2961fd, today's HEAD) but were merged after the v3.3.1 release (2026-06-12). There is no released version that includes both fixes yet.

Workaround until the next release

There is no clean workaround in v3.3.1 for Bug 2: the backend will wipe sockopt on every save regardless of what the frontend sends. If you need sockopt (e.g. for TProxy) on a tunnel inbound before the next release, the only option is to edit x-ui.db directly or use the Xray config file rather than the panel UI.

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

<!-- gh-comment-id:4777968741 --> @github-actions[bot] commented on GitHub (Jun 23, 2026): Two distinct bugs are at play here, both confirmed in the source and both already fixed on `main`. **Bug 1 — Frontend validation: `streamSettings.security — Invalid input`** `SecuritySettingsSchema` in `frontend/src/schemas/protocols/security/index.ts` is a Zod discriminated union keyed on `security`. In v3.3.1 it only accepted the values `'none'`, `'tls'`, and `'reality'`; any `streamSettings` object where the `security` key was absent (which can happen in the tunnel form path) failed validation with the reported error. The fix — adding a second union branch `z.object({ security: z.never().optional() })` to handle transportless protocols like tunnel/dokodemo-door — was shipped in the commit that closed #5339 (`fix(frontend): TProxy schema, VLESS+XHTTP flow links, clearable Jalali date picker`). **Bug 2 — Backend normalization silently wipes `streamSettings` for tunnel** `normalizeStreamSettings()` in `internal/web/service/inbound.go` clears `inbound.StreamSettings` for any protocol not in a hardcoded whitelist. In v3.3.1, `tunnel` (dokodemo-door) was absent from that whitelist, so the backend discarded the entire `streamSettings` — including `sockopt` — on every add and update call. This is why manually inserting `"security": "none"` in the JSON editor allowed the save to pass frontend validation, but the `sockopt` changes still did not persist. The fix adds `model.Tunnel: true` to the whitelist and was committed as `fix(inbound): persist streamSettings for tunnel so sockopt saves`. **Status** Both commits are on `main` (confirmed as ancestors of `a2961fd`, today's HEAD) but were merged after the v3.3.1 release (2026-06-12). There is no released version that includes both fixes yet. **Workaround until the next release** There is no clean workaround in v3.3.1 for Bug 2: the backend will wipe `sockopt` on every save regardless of what the frontend sends. If you need `sockopt` (e.g. for TProxy) on a tunnel inbound before the next release, the only option is to edit `x-ui.db` directly or use the Xray config file rather than the panel UI. *This reply was generated automatically; a maintainer may follow up.*
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#3838
No description provided.