[GH-ISSUE #6953] [Bug]: Remote panel update via mTLS node fails with HTTP 403 error #4599

Open
opened 2026-10-31 20:40:47 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @jamesliu96 on GitHub (Oct 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6953

Describe the bug

When attempting to trigger a remote panel update from a Node connected via mTLS without providing a Bearer Token, the request fails with an error. Other remote API endpoints functioning over mTLS appear to work normally.

How to reproduce the problem

  1. Set up a 3x-ui Node connection authenticated via mTLS.
  2. Trigger a remote panel update operation from the Node endpoint without passing an explicit Bearer Token in the request headers.
  3. Observe the /panel/api/nodes/updatePanel API response failing:
{"msg":"this API token is not permitted to access this endpoint","success":false}

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.11.0

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Debian 13

Which parts of the panel are affected?

Multi-node (sub-nodes)

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

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 @jamesliu96 on GitHub (Oct 26, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6953 ### Describe the bug When attempting to trigger a remote panel update from a Node connected via mTLS without providing a Bearer Token, the request fails with an error. Other remote API endpoints functioning over mTLS appear to work normally. ### How to reproduce the problem 1. Set up a 3x-ui Node connection authenticated via mTLS. 2. Trigger a remote panel update operation from the Node endpoint without passing an explicit Bearer Token in the request headers. 3. Observe the `/panel/api/nodes/updatePanel` API response failing: ```json {"msg":"this API token is not permitted to access this endpoint","success":false} ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.11.0 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Debian 13 ### Which parts of the panel are affected? Multi-node (sub-nodes) ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### 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).
Author
Owner

@github-actions[bot] commented on GitHub (Oct 26, 2026):

This 403 is intended since v3.11.0. A node connected over mTLS with no bearer token is treated as a node-sync identity, and node-sync is not allowed to start a panel self-update. To update that node from the master, create an API token with the node-admin scope on the node, then paste it into the master's API token field for that node. Keep the TLS verify mode on mtls. The client certificate still authenticates the connection, and the node-admin bearer raises the request so it can call updatePanel.

Why it happens

On the node, checkAPIAuth gives a verified client certificate the node-sync scope. Only a node-admin bearer token raises that scope (internal/web/controller/api.go:51-58):

// Verified mTLS keeps its historical node-sync identity. Only an explicit
// node-admin bearer elevates it to software-update authority.
if c.Request.TLS != nil && len(c.Request.TLS.VerifiedChains) > 0 {
	scope := model.ApiScopeNodeSync
	if matchedScope == model.ApiScopeNodeAdmin {
		scope = model.ApiScopeNodeAdmin
	}

/server/updatePanel appears only in nodeAdminScopeAllow (api.go:127-129). It is not in nodeSyncScopeAllow (api.go:99-125), so enforceTokenScope rejects the request with exactly the message you saw (api.go:153-158).

On the master, /panel/api/nodes/updatePanel (internal/web/controller/node.go:335) calls Remote.UpdatePanel, which sends POST panel/api/server/updatePanel to the node (internal/web/runtime/remote.go:713-719). Remote.do adds Authorization: Bearer … only when the node has a token stored (remote.go:267-273). A token is optional in mTLS mode (remote.go:214-216), so a node with no token reaches the node as plain node-sync and gets the 403. Other endpoints work because they are all in the node-sync allowlist.

The gap that is real

The behaviour is deliberate, but the multi-node guide does not mention it. docs/content/docs/en/operations/multi-node.mdx:26 says the API token is "not needed in mTLS mode". Lines 65-66 say "The master now presents a client certificate instead of an API token." Neither line says that Update panel still needs a node-admin token on an mTLS node. That requirement is documented only in docs/architecture.md:358-361 and the API reference. I have relabelled this as documentation and left it open for that.

Verdict: Not a bug (expected behaviour)
Severity: N/A
Confidence: High
Root cause: No defect. checkAPIAuth (internal/web/controller/api.go:53-58) deliberately maps verified mTLS without a node-admin bearer to node-sync, which nodeSyncScopeAllow does not let call /server/updatePanel. Introduced on purpose in a8d0700b "fix(auth): add node-admin token scope for panel updates (#6666)", shipped in v3.11.0.
Same class: None found. nodeAdminScopeAllow (api.go:127-129) holds only /server/updatePanel, so no other endpoint is blocked for mTLS-only nodes this way.
Already fixed: Not applicable
Duplicate of: None (related: PR #6666, which introduced the scope)
Evidence: The commit message for a8d0700b says "Allow only an explicit node-admin bearer to elevate a verified mTLS request." TestCheckAPIAuth_AcceptsVerifiedClientCert (internal/web/controller/api_auth_test.go:147) asserts that mTLS without a node-admin bearer gets 403 on updatePanel. TestPanelUpdateRequiresNodeAdminScope pins the same message for node-sync. docs/architecture.md:358-361: "On an mTLS connection, only a valid node-admin bearer elevates the request".
Not determined: None

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

<!-- gh-comment-id:6414444812 --> @github-actions[bot] commented on GitHub (Oct 26, 2026): This 403 is intended since v3.11.0. A node connected over mTLS with no bearer token is treated as a `node-sync` identity, and `node-sync` is not allowed to start a panel self-update. To update that node from the master, create an API token with the **`node-admin`** scope on the **node**, then paste it into the master's **API token** field for that node. Keep the TLS verify mode on `mtls`. The client certificate still authenticates the connection, and the `node-admin` bearer raises the request so it can call `updatePanel`. ### Why it happens On the node, `checkAPIAuth` gives a verified client certificate the `node-sync` scope. Only a `node-admin` bearer token raises that scope (`internal/web/controller/api.go:51-58`): ```go // Verified mTLS keeps its historical node-sync identity. Only an explicit // node-admin bearer elevates it to software-update authority. if c.Request.TLS != nil && len(c.Request.TLS.VerifiedChains) > 0 { scope := model.ApiScopeNodeSync if matchedScope == model.ApiScopeNodeAdmin { scope = model.ApiScopeNodeAdmin } ``` `/server/updatePanel` appears only in `nodeAdminScopeAllow` (`api.go:127-129`). It is not in `nodeSyncScopeAllow` (`api.go:99-125`), so `enforceTokenScope` rejects the request with exactly the message you saw (`api.go:153-158`). On the master, `/panel/api/nodes/updatePanel` (`internal/web/controller/node.go:335`) calls `Remote.UpdatePanel`, which sends `POST panel/api/server/updatePanel` to the node (`internal/web/runtime/remote.go:713-719`). `Remote.do` adds `Authorization: Bearer …` only when the node has a token stored (`remote.go:267-273`). A token is optional in mTLS mode (`remote.go:214-216`), so a node with no token reaches the node as plain `node-sync` and gets the 403. Other endpoints work because they are all in the `node-sync` allowlist. ### The gap that is real The behaviour is deliberate, but the multi-node guide does not mention it. `docs/content/docs/en/operations/multi-node.mdx:26` says the API token is "not needed in mTLS mode". Lines 65-66 say "The master now presents a client certificate instead of an API token." Neither line says that **Update panel** still needs a `node-admin` token on an mTLS node. That requirement is documented only in `docs/architecture.md:358-361` and the API reference. I have relabelled this as documentation and left it open for that. Verdict: Not a bug (expected behaviour) Severity: N/A Confidence: High Root cause: No defect. `checkAPIAuth` (`internal/web/controller/api.go:53-58`) deliberately maps verified mTLS without a `node-admin` bearer to `node-sync`, which `nodeSyncScopeAllow` does not let call `/server/updatePanel`. Introduced on purpose in a8d0700b "fix(auth): add node-admin token scope for panel updates (#6666)", shipped in v3.11.0. Same class: None found. `nodeAdminScopeAllow` (`api.go:127-129`) holds only `/server/updatePanel`, so no other endpoint is blocked for mTLS-only nodes this way. Already fixed: Not applicable Duplicate of: None (related: PR #6666, which introduced the scope) Evidence: The commit message for a8d0700b says "Allow only an explicit node-admin bearer to elevate a verified mTLS request." `TestCheckAPIAuth_AcceptsVerifiedClientCert` (`internal/web/controller/api_auth_test.go:147`) asserts that mTLS without a node-admin bearer gets 403 on `updatePanel`. `TestPanelUpdateRequiresNodeAdminScope` pins the same message for `node-sync`. `docs/architecture.md:358-361`: "On an mTLS connection, only a valid `node-admin` bearer elevates the request". Not determined: None *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@NikanZeyaei commented on GitHub (Oct 26, 2026):

Opened #6957, which documents this: the multi-node guide (en/zh/ru/fa) and the node form's mTLS hint now say that Update panel on an mTLS node needs an API token with the node-admin scope.

<!-- gh-comment-id:6416931916 --> @NikanZeyaei commented on GitHub (Oct 26, 2026): Opened #6957, which documents this: the multi-node guide (en/zh/ru/fa) and the node form's mTLS hint now say that Update panel on an mTLS node needs an API token with the `node-admin` scope.
Author
Owner

@jamesliu96 commented on GitHub (Oct 26, 2026):

Fair point.

<!-- gh-comment-id:6420303299 --> @jamesliu96 commented on GitHub (Oct 26, 2026): Fair point.
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#4599
No description provided.