mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-02 11:15:03 +03:00
fix(node): bound the panel GUIDs a peer reports
A peer's panelGuid is copied into nodes.guid and into every inbound row it reports (an indexed column), a forwarded origin GUID likewise, and a GUID-keyed IP tree or a master's global-traffic push keys one row per client. One oversized value therefore multiplied into gigabytes stored. GUIDs over 64 bytes (panels mint 36-character UUIDs) now fail the heartbeat, fall back to the reporting node's key, or are dropped.
This commit is contained in:
@@ -1285,6 +1285,10 @@ func (b *outboundBridge) removeInbound() {
|
||||
// broken node from dictating the master's allocation on every heartbeat.
|
||||
const maxProbeBodyBytes = 1 << 20 // 1 MiB
|
||||
|
||||
// maxPanelGuidLen bounds a GUID a peer reports: panels mint 36-character UUIDs, and the
|
||||
// value is copied into every inbound row and indexed columns.
|
||||
const maxPanelGuidLen = 64
|
||||
|
||||
func (s *NodeService) probe(ctx context.Context, n *model.Node, proxyURL string) (HeartbeatPatch, error) {
|
||||
patch := HeartbeatPatch{LastHeartbeat: time.Now().Unix()}
|
||||
|
||||
@@ -1392,6 +1396,10 @@ func (s *NodeService) probe(ctx context.Context, n *model.Node, proxyURL string)
|
||||
patch.XrayState = o.Xray.State
|
||||
patch.XrayError = o.Xray.ErrorMsg
|
||||
patch.PanelVersion = o.PanelVersion
|
||||
if len(o.PanelGuid) > maxPanelGuidLen {
|
||||
patch.LastError = fmt.Sprintf("remote panel reported a %d-byte panelGuid", len(o.PanelGuid))
|
||||
return patch, errors.New(patch.LastError)
|
||||
}
|
||||
patch.Guid = o.PanelGuid
|
||||
patch.UptimeSecs = o.Uptime
|
||||
patch.NetUp = o.NetIO.Up
|
||||
|
||||
Reference in New Issue
Block a user