mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #4917] [MERGED] fix: prevent stale node snapshot from re-enabling a panel-disabled client #5747
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#5747
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/4917
Author: @younesvatan78
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @MHSanaei
Base:
main← Head:fix/node-snapshot-re-enables-disabled-client📝 Commits (2)
d606f9efix(node-traffic): prevent stale node snapshot from re-enabling disabled clientadfb4ddMerge branch 'main' into fix/node-snapshot-re-enables-disabled-client📊 Changes
1 file changed (+8 additions, -1 deletions)
View changed files
📝
web/service/inbound.go(+8 -1)📄 Description
Problem
When a remote node syncs traffic back to the panel (
setRemoteTrafficLocked), the SQL update unconditionally overwritesclient_traffics.enablewith the value from the node snapshot (cs.Enable).If a snapshot carrying
enable=truearrives after the central panel has already setenable=false(because the client hit their traffic limit), it silently re-enables the client. The client then keeps consuming traffic until the next disable cycle catches up — in practice 2–3× their allotted quota.This was confirmed in production: users with a 10 GB limit were only disabled at 20–25 GB.
Root cause
Fix
Replace the unconditional
SET enable = ?with aCASEexpression that only allows a node snapshot to disable a client (1 → 0), never to re-enable one (0 → 1). The central panel remains the sole authority for turning a client back on.Test
enable=false.enablestaysfalseregardless of what the node snapshot says.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.