Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

test(monitoring): protect asymmetric bridge association boundaries

pulse-triage[bot]7f80c2c0b88d
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 91bdad6fed..2ddfb9dcf0 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -7849,3 +7849,14 @@ against interleaved Linux procfs counters.
`internal/hostmetrics/issue1894_interleaved_collectors_test.go` independently
pins isolated collector deltas and startup fallback. This changes telemetry
sampling only, not report schemas, identity, enrollment or command authority.
+
+### Asymmetric bridge evidence regression coverage
+
+`TestApplyHostReportBridgeIdentity` verifies two consecutive reports through
+host ingestion and checks both host-to-node and reciprocal node-to-agent links.
+Custom management bridges, private IPv4 and ULA addresses retain association
+when names differ and the provider endpoint is DNS-based. A Docker or generated
+bridge on either side alone must not supply inferred identity: testing only
+symmetric bridges would miss removal of filtering from one inventory.
+This proof does not establish safety for arbitrarily renamed Docker bridges
+or repair persisted links, and is not reporter or installed-release validation.
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
index 30cf3baaf7..6bab17f702 100644
--- a/docs/release-control/v6/internal/subsystems/monitoring.md
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -3771,3 +3771,14 @@ ordinary host metrics, but missing stats, storage, images, networks, volumes,
Swarm, and update evidence remain absent rather than being reconstructed from
older or adjacent observations. Model, monitor, and unified-resource tests pin
the additive field through the ingestion path.
+
+### Asymmetric bridge evidence regression coverage
+
+`TestApplyHostReportBridgeIdentity` verifies two consecutive reports through
+host ingestion and checks both host-to-node and reciprocal node-to-agent links.
+Custom management bridges, private IPv4 and ULA addresses retain association
+when names differ and the provider endpoint is DNS-based. A Docker or generated
+bridge on either side alone must not supply inferred identity: testing only
+symmetric bridges would miss removal of filtering from one inventory.
+This proof does not establish safety for arbitrarily renamed Docker bridges
+or repair persisted links, and is not reporter or installed-release validation.
diff --git a/internal/monitoring/monitor_host_agents_test.go b/internal/monitoring/monitor_host_agents_test.go
index 07c5246b79..1647961332 100644
--- a/internal/monitoring/monitor_host_agents_test.go
+++ b/internal/monitoring/monitor_host_agents_test.go
@@ -5784,3 +5784,55 @@ func TestApplyHostReportDoesNotLinkUnrelatedDockerBridge(t *testing.T) {
}
}
}
+
+// Exercise each side independently: symmetric fixtures alone would still pass
+// if filtering accidentally disappeared from either address inventory.
+func TestApplyHostReportBridgeIdentity(t *testing.T) {
+ for _, tc := range []struct {
+ name, providerNIC, agentNIC, address string
+ wantLink bool
+ }{
+ {"custom management", "br-mgmt", "br-mgmt", "192.0.2.10/24", true},
+ {"private management", "vmbr0", "eth0", "172.17.0.1/16", true},
+ {"ULA management", "br-mgmt", "eth0", "fd00::10/64", true},
+ {"provider docker only", "docker0", "eth0", "172.17.0.1/16", false},
+ {"agent docker only", "vmbr0", "docker0", "172.17.0.1/16", false},
+ {"provider generated bridge only", "br-0123456789ab", "eth0", "192.0.2.10/24", false},
+ {"agent generated bridge only", "vmbr0", "br-0123456789ab", "192.0.2.10/24", false},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ monitor := issue1654Monitor()
+ monitor.state.UpdateNodes([]models.Node{{
+ ID: "pve-node", Name: "pve", Instance: "cluster",
+ Host: "https://pve.example:8006",
+ NetworkInterfaces: []models.HostNetworkInterface{
+ {Name: tc.providerNIC, Addresses: []string{tc.address}},
+ },
+ }})
+ report := issue1654Report(time.Now().UTC())
+ // Different names and a DNS endpoint force network evidence.
+ report.Host.Hostname = "agent.example"
+ report.Network = []agentshost.NetworkInterface{
+ {Name: tc.agentNIC, Addresses: []string{tc.address}},
+ }
+ for i := 0; i < 2; i++ {
+ report.Timestamp = report.Timestamp.Add(time.Second)
+ host, err := monitor.ApplyHostReport(report, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ wantNode, wantAgent := "", ""
+ if tc.wantLink {
+ wantNode, wantAgent = "pve-node", host.ID
+ }
+ if host.LinkedNodeID != wantNode {
+ t.Fatalf("report %d: linked node = %q, want %q", i, host.LinkedNodeID, wantNode)
+ }
+ nodes := monitor.state.GetSnapshot().Nodes
+ if len(nodes) != 1 || nodes[0].LinkedAgentID != wantAgent {
+ t.Fatalf("report %d: reciprocal link mismatch, want agent %q", i, wantAgent)
+ }
+ }
+ })
+ }
+}