mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6565] [MERGED] fix(nodes): say which half of node mTLS failed, and say it as an error #6354
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6565
Author: @n0ctal
Created: 9/16/2026
Status: ✅ Merged
Merged: 9/16/2026
Merged by: @MHSanaei
Base:
main← Head:upstream-node-mtls-trust-bundle-diagnostics📝 Commits (2)
f8e5d22fix(nodes): say which half of node mTLS failed, and say it as an error2795737test(nodes): drop a duplicate node mTLS trust-bundle test📊 Changes
3 files changed (+33 additions, -4 deletions)
View changed files
📝
internal/web/service/setting_mtls.go(+5 -1)📝
internal/web/service/setting_mtls_bundle_test.go(+19 -0)📝
internal/web/web.go(+9 -3)📄 Description
Summary
A node mTLS trust bundle that will not parse is reported exactly like a settings
read that failed, and both are warnings:
ClientAuthis then never set, so the node API stops accepting clientcertificates entirely. A node whose sync credential is a certificate loses its
only credential, or silently falls back to a bearer token — and the single line
saying so is a warning emitted once at boot.
This reports it at error level and separates the two causes.
NodeMtlsClientCAPooltags the parse failure withErrNodeMtlsTrustBundleInvalid; the message text is unchanged, so anythingmatching on the existing string keeps matching.
Why not fail to start
Refusing to boot was considered and rejected. The bundle is one of two equal
credentials here —
checkAPIAuthaccepts a verified chain or a bearer token —so a stopped panel protects nothing while taking the proxies and the
subscription server down with it. Worse, bundles written before the stricter
validation in #6188 are already stored, and the setting is editable only through
the panel that would no longer come up.
Scope
internal/web/service/setting_mtls.go— the sentinel, wrapped into theexisting message.
internal/web/web.go— error level, and the two causes told apart.internal/web/service/setting_mtls_bundle_test.go— two tests.No behaviour change to startup, to the listener, or to any panel without a
trust bundle configured.
Validation
go build ./...,golangci-lint run ./internal/web/...→ 0 issues.go test ./internal/web/ ./internal/web/service/→ ok.one. Dropping the sentinel turns the first red:
NodeMtlsClientCAPool() error = nodeMtlsClientCAPem is not a valid certificate bundle: certificate bundle contains malformed or non-PEM data, want it to wrap ErrNodeMtlsTrustBundleInvalid.TestNodeMtlsClientCAPoolRejectsPartiallyValidBundle, which asserts the fullmessage string, still passes unchanged.
Risk
The only visible change is a log line moving from warning to error and gaining a
sentence. A panel with no bundle configured never reaches either branch.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.