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.

Hide public demo admin reads

rcourtmane3c1dad25621
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 6f0084d781..392e7282ba 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -816,7 +816,10 @@ That same demo-hidden API boundary also keeps runtime-admin operations out of
public lifecycle flows: `/api/diagnostics`,
`/api/diagnostics/docker/prepare-token`, and `/api/logs/*` must return `404`
in demo mode instead of exposing runtime bundles, log streams, or diagnostics
-payloads through a nominally read-only preview account.
+payloads through a nominally read-only preview account. `GET` and `HEAD` reads
+for `/api/admin/users` and manual discovery at `/api/discover` are part of
+that same hidden boundary; lifecycle-adjacent UI must not rely on those routes
+remaining discoverable in public demo mode.
Lifecycle-owned browser shells must also defer any commercial helper reads
until that presentation policy resolves so demo suppression stays fail-closed
during first render instead of racing hidden commercial endpoints from shared
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 2b997128ed..6fb6e6fc1b 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -84,8 +84,9 @@ product API routes free of maintainer commercial analytics.
51. `internal/api/recovery_handlers.go`
52. `internal/api/config_setup_handlers.go`
53. `internal/api/demo_mode_commercial.go`
-54. `internal/api/security_status_capabilities.go`
-55. `internal/api/demo_middleware.go`
+54. `internal/api/demo_mode_operations.go`
+55. `internal/api/security_status_capabilities.go`
+56. `internal/api/demo_middleware.go`
56. `frontend-modern/src/stores/aiRuntimeState.ts`
57. `internal/api/connections_types.go`
58. `internal/api/connections_aggregator.go`
@@ -1913,7 +1914,10 @@ surfaces instead of treating them as harmless reads. Demo sessions must receive
`404` for `/api/diagnostics`, `/api/diagnostics/docker/prepare-token`, and the
shared `/api/logs/*` endpoints, so the preview shell cannot expose runtime
diagnostics, log streams, or downloadable log bundles behind a supposedly
-read-only demo account.
+read-only demo account. That same hidden read-side boundary includes `GET` and
+`HEAD` reads for `/api/admin/users` and manual discovery at `/api/discover`;
+public demo mode may block writes generically, but it must not reveal that
+admin-user inventory or manual-discovery read routes exist.
That shared infrastructure install boundary now also preserves copied shell
command payload continuity: any privilege-escalation wrapper applied at
`frontend-modern/src/components/Settings/InfrastructureInstallerSection.tsx`
@@ -3419,6 +3423,10 @@ reads or preview probes whenever `DEMO_MODE` is enabled. Demo runtimes may
still use real server-side entitlement evaluation internally, but the
governed browser/API contract must not expose commercial identity, usage, or
upgrade-state payloads back to public viewers through those read surfaces.
+The adjacent public-demo admin-operations policy also hides `GET`/`HEAD`
+probes for `/api/admin/users` and `/api/discover` with the same generic `404`
+posture, while non-read attempts still fall through to the demo read-only
+mutation block so write probes retain the canonical `403`.
That same monitored-system admission contract now also owns direct write-path
failure semantics for platform connections. `internal/api/truenas_handlers.go`,
`internal/api/vmware_handlers.go`,
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 60e6544371..fbd4c8dfe0 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -275,7 +275,10 @@ stale-plan hash, blast-radius model, or execution protocol outside
hidden from public preview sessions: `/api/diagnostics`,
`/api/diagnostics/docker/prepare-token`, and `/api/logs/*` must not remain
readable side channels while storage or recovery demo routes are otherwise
- presented as read-only product surfaces.
+ presented as read-only product surfaces. `GET` and `HEAD` reads for
+ `/api/admin/users` and manual discovery at `/api/discover` must stay hidden
+ for the same reason; recovery-adjacent pages must not treat those
+ admin-oriented read routes as safe public-demo evidence.
Storage and recovery consumers must also inherit the hook's canonical
`ResourceType` normalization for route/query filters, so storage subtypes
such as `physical_disk` stay on the same cache-backed snapshot instead of
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 7c5eca8e01..f900bc92f9 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -6655,6 +6655,12 @@ func TestContract_DemoModeCommercialSurfacePolicy(t *testing.T) {
{method: http.MethodGet, path: "/api/logs/download"},
{method: http.MethodGet, path: "/api/logs/level"},
{method: http.MethodPost, path: "/api/logs/level"},
+ {method: http.MethodGet, path: "/api/admin/users"},
+ {method: http.MethodGet, path: "/api/admin/users/"},
+ {method: http.MethodHead, path: "/api/admin/users"},
+ {method: http.MethodGet, path: "/api/discover"},
+ {method: http.MethodGet, path: "/api/discover/"},
+ {method: http.MethodHead, path: "/api/discover"},
{method: http.MethodGet, path: licensePurchaseStartPath},
}
diff --git a/internal/api/demo_middleware_test.go b/internal/api/demo_middleware_test.go
index 12281a4be4..3ed38b032f 100644
--- a/internal/api/demo_middleware_test.go
+++ b/internal/api/demo_middleware_test.go
@@ -70,6 +70,10 @@ func TestDemoModeMiddleware(t *testing.T) {
{"demo on hidden logs download", true, http.MethodGet, "/api/logs/download", "", false, http.StatusNotFound, true},
{"demo on hidden logs level read", true, http.MethodGet, "/api/logs/level", "", false, http.StatusNotFound, true},
{"demo on hidden logs level write", true, http.MethodPost, "/api/logs/level", "", false, http.StatusNotFound, true},
+ {"demo on hidden admin users read", true, http.MethodGet, "/api/admin/users", "", false, http.StatusNotFound, true},
+ {"demo on hidden admin users read head", true, http.MethodHead, "/api/admin/users", "", false, http.StatusNotFound, true},
+ {"demo on hidden manual discovery read", true, http.MethodGet, "/api/discover", "", false, http.StatusNotFound, true},
+ {"demo on hidden manual discovery head", true, http.MethodHead, "/api/discover", "", false, http.StatusNotFound, true},
{"demo on hidden checkout start", true, http.MethodGet, "/auth/license-purchase-start", "", false, http.StatusNotFound, true},
{"demo on hidden license activate", true, http.MethodPost, "/api/license/activate", "", false, http.StatusNotFound, true},
{"demo on hidden purchase start", true, http.MethodGet, licensePurchaseStartPath, "", false, http.StatusNotFound, true},
@@ -89,6 +93,8 @@ func TestDemoModeMiddleware(t *testing.T) {
// Demo mode enabled - POST to other paths blocked
{"demo on POST settings", true, http.MethodPost, "/api/settings", "", false, http.StatusForbidden, true},
{"demo on POST config", true, http.MethodPost, "/api/config", "", false, http.StatusForbidden, true},
+ {"demo on POST discover", true, http.MethodPost, "/api/discover", "", false, http.StatusForbidden, true},
+ {"demo on POST admin users", true, http.MethodPost, "/api/admin/users", "", false, http.StatusForbidden, true},
{"demo on DELETE docker host", true, http.MethodDelete, "/api/docker-hosts/1", "", false, http.StatusForbidden, true},
}
diff --git a/internal/api/demo_mode_commercial.go b/internal/api/demo_mode_commercial.go
index 7c83cccf50..1be969ab5d 100644
--- a/internal/api/demo_mode_commercial.go
+++ b/internal/api/demo_mode_commercial.go
@@ -166,6 +166,15 @@ func exactDemoCommercialMethodPath(method, path string) func(*http.Request) bool
}
}
+func readDemoCommercialPath(path string) func(*http.Request) bool {
+ return func(r *http.Request) bool {
+ if r == nil || (r.Method != http.MethodGet && r.Method != http.MethodHead) {
+ return false
+ }
+ return exactDemoCommercialPath(path)(r)
+ }
+}
+
func exactDemoCommercialOrgBillingStatePath(method string) func(*http.Request) bool {
return func(r *http.Request) bool {
if r == nil || r.Method != method || r.URL == nil {
diff --git a/internal/api/demo_mode_operations.go b/internal/api/demo_mode_operations.go
index c4f30dcd95..bad26c86c4 100644
--- a/internal/api/demo_mode_operations.go
+++ b/internal/api/demo_mode_operations.go
@@ -6,7 +6,7 @@ var publicDemoAdminOperationsPolicies = []publicDemoCommercialRoutePolicy{
{
route: "GET /api/diagnostics",
exposure: publicDemoCommercialExposureHidden,
- matches: exactDemoCommercialMethodPath(http.MethodGet, "/api/diagnostics"),
+ matches: readDemoCommercialPath("/api/diagnostics"),
},
{
route: "POST /api/diagnostics/docker/prepare-token",
@@ -16,23 +16,33 @@ var publicDemoAdminOperationsPolicies = []publicDemoCommercialRoutePolicy{
{
route: "GET /api/logs/stream",
exposure: publicDemoCommercialExposureHidden,
- matches: exactDemoCommercialMethodPath(http.MethodGet, "/api/logs/stream"),
+ matches: readDemoCommercialPath("/api/logs/stream"),
},
{
route: "GET /api/logs/download",
exposure: publicDemoCommercialExposureHidden,
- matches: exactDemoCommercialMethodPath(http.MethodGet, "/api/logs/download"),
+ matches: readDemoCommercialPath("/api/logs/download"),
},
{
route: "GET /api/logs/level",
exposure: publicDemoCommercialExposureHidden,
- matches: exactDemoCommercialMethodPath(http.MethodGet, "/api/logs/level"),
+ matches: readDemoCommercialPath("/api/logs/level"),
},
{
route: "POST /api/logs/level",
exposure: publicDemoCommercialExposureHidden,
matches: exactDemoCommercialMethodPath(http.MethodPost, "/api/logs/level"),
},
+ {
+ route: "GET /api/admin/users",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: readDemoCommercialPath("/api/admin/users"),
+ },
+ {
+ route: "GET /api/discover",
+ exposure: publicDemoCommercialExposureHidden,
+ matches: readDemoCommercialPath("/api/discover"),
+ },
}
func publicDemoAdminOperationsPolicyForRequest(
diff --git a/internal/api/demo_mode_operations_test.go b/internal/api/demo_mode_operations_test.go
index de1198b945..2596013369 100644
--- a/internal/api/demo_mode_operations_test.go
+++ b/internal/api/demo_mode_operations_test.go
@@ -18,6 +18,11 @@ func TestPublicDemoAdminOperationsPolicyForRequest(t *testing.T) {
{name: "logs download", method: http.MethodGet, path: "/api/logs/download"},
{name: "logs level read", method: http.MethodGet, path: "/api/logs/level"},
{name: "logs level write", method: http.MethodPost, path: "/api/logs/level"},
+ {name: "admin users read", method: http.MethodGet, path: "/api/admin/users"},
+ {name: "admin users trailing slash read", method: http.MethodGet, path: "/api/admin/users/"},
+ {name: "admin users head", method: http.MethodHead, path: "/api/admin/users"},
+ {name: "manual discovery read", method: http.MethodGet, path: "/api/discover"},
+ {name: "manual discovery head", method: http.MethodHead, path: "/api/discover"},
}
for _, tc := range hiddenRoutes {
@@ -41,6 +46,8 @@ func TestPublicDemoAdminOperationsPolicyForRequest(t *testing.T) {
{name: "health", method: http.MethodGet, path: "/api/health"},
{name: "resources", method: http.MethodGet, path: "/api/resources"},
{name: "runtime capabilities", method: http.MethodGet, path: "/api/license/runtime-capabilities"},
+ {name: "admin users write", method: http.MethodPost, path: "/api/admin/users"},
+ {name: "manual discovery write", method: http.MethodPost, path: "/api/discover"},
}
for _, tc := range allowedRoutes {
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 49531bd2a6..c76304c385 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -3625,8 +3625,8 @@ class SubsystemLookupTest(unittest.TestCase):
{
"heading": "## Shared Boundaries",
"path": "internal/api/access_control_handlers.go",
- "line": 162,
- "heading_line": 97,
+ "line": 163,
+ "heading_line": 98,
}
],
)