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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Restrict commercial metrics reporting access
rcourtman0bbba3b8184e
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 7fe1072e99..9be3207f57 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -1663,7 +1663,10 @@ That same shared diagnostics dependency now also assumes local commercial andonboarding analytics stay out of user diagnostics entirely: lifecycle-adjacentadmin surfaces may consume operational diagnostics, but they must not restoreself-hosted upgrade-metric summaries or infrastructure-onboarding analytics to-`internal/api/diagnostics.go` or the settings diagnostics panel.+`internal/api/diagnostics.go` or the settings diagnostics panel. The local+commercial metrics reporting routes remain API/cloud-paid admin settings+surfaces and must not become lifecycle setup, install, or fleet-progress+signals.Lifecycle-adjacent Docker and Podman agent diagnostics are part of that sameshared backend dependency. When `internal/api/diagnostics.go` emits agenthealth notes for Docker and Podman, the copy must keep Infrastructure as thediff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 4c61c9286e..3770ec4bd6 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -20,7 +20,9 @@## Purpose-Own canonical runtime payload shapes between backend and frontend.+Own canonical runtime payload shapes between backend and frontend, including+the privileged boundary between customer-safe support diagnostics and+admin-only local commercial reporting routes.## Canonical Files1. `internal/api/contract_test.go`@@ -1807,6 +1809,13 @@ now checks `internal/api/diagnostics.go` alongside the Settings diagnosticsfrontend boundary through the canonical frontend audit runner, so thisadmin-analytics payload class cannot return as a customer-visible diagnosticscontract.+That same admin-analytics boundary applies to the local commercial metrics+reporting routes themselves: `/api/upgrade-metrics/stats`,+`/api/upgrade-metrics/health`, `/api/upgrade-metrics/config`, and+`/api/admin/upgrade-metrics-funnel` must require admin/settings-scope access+rather than becoming general authenticated product reads. Authenticated event+ingestion at `/api/upgrade-metrics/events` may remain fire-and-forget UX+plumbing, but reporting and control stay on the privileged settings boundary.That same public-demo API boundary must also hide runtime-admin operationssurfaces instead of treating them as harmless reads. Demo sessions must receive`404` for `/api/diagnostics`, `/api/diagnostics/docker/prepare-token`, and thediff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex 0e8515933e..329e2d5be0 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -540,6 +540,10 @@ runtime gating as separate unlinked claims.`frontend-modern/src/components/Settings/DiagnosticsResultsPanel.tsx`, and`frontend-modern/src/components/Settings/diagnosticsModel.ts` must notexpose them in the customer support diagnostics payload or panel.+ The local reporting/control endpoints themselves must stay privileged:+ stats, health, config, and funnel reads must require admin plus+ settings-scope access; only event ingestion may remain an authenticated+ fire-and-forget path for user interactions.16. Keep ordinary self-hosted v6 commercial prompts opt-in. Cloud-paid runtimemay keep checkout, activation, recovery, and support-only trial plumbingavailable for explicit handoffs and entitled installs, but default@@ -1908,7 +1912,10 @@ self-hosted commercial reporting, but not for user support diagnostics:admin-owned reporting surfaces may read structured local funnel reports from`pkg/licensing/conversion_store.go`, while `/api/diagnostics` and the Settingssupport diagnostics panel must not expose pricing, checkout, conversion, or-infrastructure-onboarding analytics.+infrastructure-onboarding analytics. The API route boundary must preserve that+same split: local commercial metric stats, health, config, and funnel reads are+admin/settings-scope surfaces, while `/api/upgrade-metrics/events` remains only+the authenticated local ingestion path for explicit product interactions.Stripe checkout and subscription webhook persistence now also follows thecanonical Cloud/MSP limit rule: when paid state is granted, billing-statewrites must persist authoritative `limits.max_monitored_systems` derived from canonicaldiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 11c8f990e7..d721d8424a 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -21,7 +21,9 @@## PurposeOwn the storage and recovery product surfaces, recovery-point persistence and-querying, and the operator-facing storage health presentation layer.+querying, and the operator-facing storage health presentation layer while+keeping adjacent commercial reporting APIs out of storage/recovery product+state.## Canonical Files@@ -1932,6 +1934,10 @@ return `404` for that path without mutating entitlements. The retiredstorage/recovery-local retry or backoff behavior. Retired`trial_eligible`/`trial_eligibility_reason` payload fields are compatibilityonly and must not become storage/recovery prompt, identity, or restore state.+Local commercial metrics reporting routes are part of the same adjacent+API/cloud-paid admin settings boundary: storage and recovery surfaces must not+read stats, health, config, or funnel reports as customer-visible recovery,+storage-health, or setup state.That same shared `internal/api/` dependency now also assumes adjacentcommercial helper surfaces speak in monitored-system terms: recovery- orstorage-adjacent API wiring may consume the canonical monitored-system ledgerdiff --git a/internal/api/contract_test.go b/internal/api/contract_test.goindex 51e8ca9bf5..cacb06fad3 100644--- a/internal/api/contract_test.go+++ b/internal/api/contract_test.go@@ -2676,6 +2676,33 @@ func TestContract_ReportingCatalogRouteAccessibleWithoutReportingFeature(t *test}}+func TestContract_LocalCommercialReportingRoutesRequireSettingsReadScope(t *testing.T) {+ rawToken := "commercial-reporting-contract-token-123.12345678"+ record := newTokenRecord(t, rawToken, []string{config.ScopeAgentReport}, nil)+ cfg := newTestConfigWithTokens(t, record)+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")++ for _, tc := range []struct {+ method string+ path string+ }{+ {method: http.MethodGet, path: "/api/upgrade-metrics/stats"},+ {method: http.MethodGet, path: "/api/upgrade-metrics/health"},+ {method: http.MethodGet, path: "/api/upgrade-metrics/config"},+ {method: http.MethodGet, path: "/api/admin/upgrade-metrics-funnel"},+ } {+ t.Run(tc.method+" "+tc.path, func(t *testing.T) {+ req := httptest.NewRequest(tc.method, tc.path, nil)+ req.Header.Set("X-API-Token", rawToken)+ rec := httptest.NewRecorder()++ router.Handler().ServeHTTP(rec, req)++ assertMissingScope(t, rec, config.ScopeSettingsRead, tc.method+" "+tc.path)+ })+ }+}+func TestContract_PerformanceReportTransportUsesCatalogDefaultRange(t *testing.T) {engine := &stubReportingEngine{data: []byte("report"), contentType: "application/pdf"}original := reporting.GetEngine()diff --git a/internal/api/conversion_handlers_test.go b/internal/api/conversion_handlers_test.goindex c934d04e9c..0fb0da03f7 100644--- a/internal/api/conversion_handlers_test.go+++ b/internal/api/conversion_handlers_test.go@@ -8,6 +8,7 @@ import ("net/http""net/http/httptest""path/filepath"+ "strings""testing""time"@@ -637,7 +638,7 @@ func TestConversionHandleConversionFunnelRejectsCrossTenantOrgOverride(t *testin}}-func TestConversionConversionFunnelRouteRequiresAdminProxyRole(t *testing.T) {+func TestConversionReportingRoutesRequireAdminProxyRole(t *testing.T) {cfg := newTestConfigWithTokens(t)cfg.ProxyAuthSecret = "proxy-secret"cfg.ProxyAuthUserHeader = "X-Proxy-User"@@ -646,15 +647,29 @@ func TestConversionConversionFunnelRouteRequiresAdminProxyRole(t *testing.T) {router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")- req := httptest.NewRequest(http.MethodGet, "/api/admin/upgrade-metrics-funnel", nil)- req.Header.Set("X-Proxy-Secret", cfg.ProxyAuthSecret)- req.Header.Set(cfg.ProxyAuthUserHeader, "alice")- req.Header.Set(cfg.ProxyAuthRoleHeader, "viewer|user")- rec := httptest.NewRecorder()-- router.Handler().ServeHTTP(rec, req)-- if rec.Code != http.StatusForbidden {- t.Fatalf("expected status %d, got %d (%s)", http.StatusForbidden, rec.Code, rec.Body.String())+ for _, tc := range []struct {+ method string+ path string+ body string+ }{+ {method: http.MethodGet, path: "/api/upgrade-metrics/stats"},+ {method: http.MethodGet, path: "/api/upgrade-metrics/health"},+ {method: http.MethodGet, path: "/api/upgrade-metrics/config"},+ {method: http.MethodPut, path: "/api/upgrade-metrics/config", body: `{"enabled":false}`},+ {method: http.MethodGet, path: "/api/admin/upgrade-metrics-funnel"},+ } {+ t.Run(tc.method+" "+tc.path, func(t *testing.T) {+ req := httptest.NewRequest(tc.method, tc.path, strings.NewReader(tc.body))+ req.Header.Set("X-Proxy-Secret", cfg.ProxyAuthSecret)+ req.Header.Set(cfg.ProxyAuthUserHeader, "alice")+ req.Header.Set(cfg.ProxyAuthRoleHeader, "viewer|user")+ rec := httptest.NewRecorder()++ router.Handler().ServeHTTP(rec, req)++ if rec.Code != http.StatusForbidden {+ t.Fatalf("expected status %d, got %d (%s)", http.StatusForbidden, rec.Code, rec.Body.String())+ }+ })}}diff --git a/internal/api/router_routes_licensing.go b/internal/api/router_routes_licensing.goindex 84e6c3eaef..f919451934 100644--- a/internal/api/router_routes_licensing.go+++ b/internal/api/router_routes_licensing.go@@ -47,21 +47,11 @@ func (r *Router) registerOrgLicenseRoutesGroup(orgHandlers *OrgHandlers, rbacHan// Local-only commercial handoff events (legacy route names retain "upgrade-metrics" for compatibility).// These are local-only signals used to debug explicit paid-plan handoffs; no external export.r.mux.HandleFunc("POST /api/upgrade-metrics/events", RequireAuth(r.config, conversionHandlers.HandleRecordEvent))- r.mux.HandleFunc("GET /api/upgrade-metrics/stats", RequireAuth(r.config, conversionHandlers.HandleGetStats))- r.mux.HandleFunc("GET /api/upgrade-metrics/health", RequireAuth(r.config, conversionHandlers.HandleGetHealth))- r.mux.HandleFunc("GET /api/upgrade-metrics/config", RequireAuth(r.config, RequireScope(config.ScopeSettingsRead, func(w http.ResponseWriter, req *http.Request) {- if !ensureSettingsReadScope(r.config, w, req) {- return- }- conversionHandlers.HandleGetConfig(w, req)- })))- r.mux.HandleFunc("PUT /api/upgrade-metrics/config", RequireAuth(r.config, RequireScope(config.ScopeSettingsWrite, func(w http.ResponseWriter, req *http.Request) {- if !ensureSettingsWriteScope(r.config, w, req) {- return- }- conversionHandlers.HandleUpdateConfig(w, req)- })))- r.mux.HandleFunc("GET /api/admin/upgrade-metrics-funnel", RequireAdmin(r.config, conversionHandlers.HandleConversionFunnel))+ r.mux.HandleFunc("GET /api/upgrade-metrics/stats", RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, conversionHandlers.HandleGetStats)))+ r.mux.HandleFunc("GET /api/upgrade-metrics/health", RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, conversionHandlers.HandleGetHealth)))+ r.mux.HandleFunc("GET /api/upgrade-metrics/config", RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, conversionHandlers.HandleGetConfig)))+ r.mux.HandleFunc("PUT /api/upgrade-metrics/config", RequireAdmin(r.config, RequireScope(config.ScopeSettingsWrite, conversionHandlers.HandleUpdateConfig)))+ r.mux.HandleFunc("GET /api/admin/upgrade-metrics-funnel", RequireAdmin(r.config, RequireScope(config.ScopeSettingsRead, conversionHandlers.HandleConversionFunnel)))// Organization routes (multi-tenant foundation)r.mux.HandleFunc("GET /api/orgs", RequireAuth(r.config, RequireScope(config.ScopeSettingsRead, orgHandlers.HandleListOrgs)))diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.pyindex 763c0b59b7..d76470dae3 100644--- a/scripts/release_control/subsystem_lookup_test.py+++ b/scripts/release_control/subsystem_lookup_test.py@@ -3606,8 +3606,8 @@ class SubsystemLookupTest(unittest.TestCase):{"heading": "## Shared Boundaries","path": "internal/api/access_control_handlers.go",- "line": 147,- "heading_line": 89,+ "line": 149,+ "heading_line": 91,}],)