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.

fix(settings): hide the admin-only System tabs from non-admin sessions

rcourtman6a958761e84b
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 31ef1eed45..aafd582e0a 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -5987,6 +5987,16 @@ Pinned by the capability cases in `useTrueNASSettingsPanelState.test.tsx` and
the accessor flips) and by the discovery source pin in
`InfrastructureOperationsModel.test.tsx`.
+`internal/api/` is a canonical reference in this contract's Extension Points,
+so this records the additive sibling added alongside that capability:
+`settingsCapabilities.systemSettingsRead`, describing the same
+`canAccessAdminSurface(config.ScopeSettingsRead)` gate for the admin-only
+System tabs. It changes no lifecycle route, payload, or agent-facing shape, and
+the infrastructure hooks above continue to read `infrastructureRead` rather
+than the new field — the two are siblings precisely so neither page's gate can
+be moved by a change aimed at the other. The api-contracts entry holds the
+authoritative description and its proof.
+
### API-layer refusal logging moved to debug
`internal/api/` is a canonical reference in this contract's Extension Points, so
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 9901a5381c..f0622b294a 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -9048,3 +9048,29 @@ pins that pairing directly — a scoped API token and a non-admin proxy session
both still get 403, no warn line is emitted, and the refusal still leaves a
debug-level trace — so a future attempt to quiet the log by relaxing enforcement
fails the contract instead of passing it.
+
+### Security status serves a systemSettingsRead settings capability
+
+`GET /api/security/status` also carries
+`settingsCapabilities.systemSettingsRead`, describing the same `RequireAdmin` +
+`settings:read` gate for the System → Network, Pulse server updates, and
+Recovery tabs. Those panels own the public URL and CORS boundaries, the server
+update channel, and backup polling plus configuration export/import; every
+route behind them answers to `settings:read`. Additive and `false` for any
+session that cannot reach them, exactly like `infrastructureRead`.
+
+It is a sibling of `infrastructureRead`, not a reuse of it. The two share the
+`canAccessAdminSurface(config.ScopeSettingsRead)` derivation today, but each
+names the surface it gates, so tightening one page's gate later cannot silently
+hide the other page's tabs — the drift this section's rule 35 exists to
+prevent. Reusing a capability whose name and doc comment scope it to a
+different surface is the same defect as re-deriving one.
+
+System → General is deliberately outside the gate: theme, language, and unit
+preferences there are user-scoped rather than instance administration, so
+withholding that tab would take personal settings away from every non-admin.
+
+`TestContract_SecurityStatusSystemSettingsReadTracksSettingsReadScope` pins the
+served value against a `settings:read` token versus a `monitoring:read` token.
+`TestSettingsCapabilitiesMatchRouteEnforcementWithoutRBAC` keeps the withheld
+case honest against live 403s on `/api/config/nodes` and `/api/system/settings`.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 6f1f0a9277..c5a70d7a33 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -5817,6 +5817,22 @@ prompt. Infrastructure has no upgrade story: every endpoint behind it is
warn-level denial on every tick. Hiding the item is what stops those pollers
mounting.
+The same rule now covers the admin-only System tabs. `system-network`,
+`system-updates`, and `system-recovery` declare
+`requiredCapability: 'systemSettingsRead'` in the same catalog, so both the
+sidebar entry and the route are withheld from a session that cannot read
+settings. They share Infrastructure's rationale rather than the paid-feature
+one: a free install can act on a paid tab by upgrading, but a non-admin cannot
+grant themselves admin, so the tab can only end in a panel they will never
+populate.
+
+`system-general` is deliberately excluded. Theme, language, and unit
+preferences on that tab are user-scoped, so gating it would take personal
+settings away from every non-admin, and the panel is not empty for them. Proof:
+`frontend-modern/src/components/Settings/__tests__/systemNavCapabilityGate.test.ts`,
+which pins the withheld, granted, and unresolved cases plus the
+`system-general` exclusion.
+
Because `DEFAULT_SETTINGS_TAB` *is* `infrastructure-systems`, the blocked-route
fallback in `useSettingsAccess.ts` can no longer resolve to the constant — that
sent a refused session straight back to the tab that had just refused it. It now
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 690b8dd3a5..e50c5ecd23 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -5060,11 +5060,20 @@ backend, on the checkout intent it already owns.
`internal/api/` is a canonical reference in this contract's Extension Points, so
this records the additive change made in
`internal/api/security_status_capabilities.go`: the settings capability payload
-served by `GET /api/security/status` now carries `infrastructureRead`, derived
-from `canAccessAdminSurface(config.ScopeSettingsRead)`. No recovery or storage
+served by `GET /api/security/status` now carries `infrastructureRead` and its
+sibling `systemSettingsRead`, both derived from
+`canAccessAdminSurface(config.ScopeSettingsRead)`. No recovery or storage
route, payload, or persisted shape changes. The api-contracts entry holds the
authoritative description and its proof.
+`systemSettingsRead` gates the System → Recovery tab, which is where operators
+reach backup polling and configuration export/import. Withholding it says only
+that the caller may not reach those admin routes — never that a backup is
+absent, a snapshot is stale, or a restore target is unavailable. A recovery
+surface that finds the capability withheld must present an access state and
+must not record the skipped fetch as coverage loss or mutate recovery
+freshness from it.
+
### API-layer refusal logging moved to debug
`internal/api/` is a canonical reference in this contract's Extension Points.
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 5beedfefe2..e092dc910f 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,16 +1,37 @@
{
"version": 1,
"result": "passed",
- "base_sha": "755a8887874e21d0115e1490b9e69e9501d2a31e",
- "verified_at": "2026-08-07T19:21:05Z",
+ "base_sha": "14a82e7684390c9fe0a4bd900417c4adbb7140b8",
+ "verified_at": "2026-08-07T20:36:11Z",
"changed_paths": [
- "frontend-modern/src/stores/websocket.ts"
+ "frontend-modern/src/components/Settings/settingsNavCatalog.ts",
+ "frontend-modern/src/types/config.ts"
],
"content_sha256": {
- "frontend-modern/src/stores/websocket.ts": "1a27dd2c374fc3fe09f718044e3685c450ff4fddfce2f0ada92ac5210676bbd9"
+ "frontend-modern/src/components/Settings/settingsNavCatalog.ts": "4bc892c16a978f7a162828f1221acbfea4ec56ee8ddc4d5993536469c86f7252",
+ "frontend-modern/src/types/config.ts": "f7fc76d882f2c6fbd00d75860434ab4a8fd5369d031b9e24a18d76f42b607c72"
},
"routes": [
- "/infrastructure (Proxmox overview, nodes + workloads tables)"
+ "/settings/system-general",
+ "/settings/system-network"
+ ],
+ "states": [
+ "verified against real admin and non-admin sessions rather than a stubbed capability: one binary built from this worktree on :8920 with PROXY_AUTH_SECRET / PROXY_AUTH_USER_HEADER / PROXY_AUTH_ROLE_HEADER / PROXY_AUTH_ADMIN_ROLE, fronted by two header-injecting reverse proxies differing only in the role header (:8921 admin-user/admin, :8922 viewer-user/viewer)",
+ "the served payload confirms the new field tracks the gate: :8921 reports detailLevel=privileged with infrastructureRead=true and systemSettingsRead=true; :8922 reports detailLevel=authenticated with both false",
+ "non-admin cold load of /settings/system-general: Network, Pulse server updates, and Recovery are all absent from the settings navigation while General remains, so user-scoped theme, language, and unit preferences stay reachable",
+ "non-admin cold load deep-linked at /settings/system-network: the route is refused and the session lands on /settings/monitoring/availability, the first tab it can actually reach - this composes with the capability-aware fallback added in 755a88878 rather than bouncing back to the blocked default",
+ "admin cold load deep-linked at /settings/system-network: the route resolves, the Network panel renders, and all three tabs are present, so the gate does not withhold from an entitled session",
+ "no stuck loading state in any of the above; this change gates nav visibility only and adds no fetch",
+ "rebased onto 14a82e768 after verification; that intervening commit moves API refusal logging from warn to debug and changes no route, payload, or frontend source, and the two verified frontend files are byte-identical across the rebase (content_sha256 unchanged), so the recorded exercise still describes this commit"
+ ],
+ "interactions": [
+ "built the frontend into the embed dir and rebuilt ./cmd/pulse so the served capability and the rendering frontend are the same artifact",
+ "curled /api/security/status through both proxies to establish the admin/non-admin A/B before touching the browser, reading infrastructureRead and systemSettingsRead side by side",
+ "cold-loaded /settings/system-general as viewer-user at 1280x720 and enumerated every settings nav control by DOM text, so items below the sidebar fold were counted",
+ "cold-loaded /settings/system-network as viewer-user and recorded the route the app settled on",
+ "cold-loaded /settings/system-network as admin-user and confirmed the panel renders with all three tabs present",
+ "repeated the non-admin /settings/system-general load at 375x812 and confirmed the same three tabs absent with General retained",
+ "screenshotted the non-admin System > General panel at 375x812"
],
"viewports": [
{
@@ -21,16 +42,5 @@
"width": 375,
"height": 812
}
- ],
- "states": [
- "inbound guard tripped: MAX_INBOUND_WEBSOCKET_MESSAGE_BYTES temporarily lowered to 256 KiB against a live backend on port 7655 whose real initialState frame is ~741 KB, reproducing the oversized-snapshot condition a >3100-resource estate hits at the shipped 8 MiB cap",
- "post-recovery steady state: 265 resources hydrated from /api/state with 48 distinct resource types, then held across subsequent resourceDelta ticks (delta frames logged with resourceCount 0 while the store stayed at 265), proving the REST snapshot established a usable delta baseline",
- "shipped 8 MiB cap restored: the same ~741 KB frame is accepted and hydrates via initialState over the socket with no oversized warning and no REST fetch, confirming the fallback is inert on normal estates"
- ],
- "interactions": [
- "loaded /infrastructure with the guard tripped and read the console sequence: 'Ignoring oversized WebSocket payload {characterCount: 741468, maxBytes: 262144}' then 'Recovering full state over REST' then 'Hydrated full state over REST after an oversized WebSocket snapshot' then 'Updating resources {count: 265}'",
- "confirmed the nodes table and workloads table rendered populated rows (6 PVE nodes with live CPU/memory/disk/temp, guest rows beneath) rather than the empty UI the dropped snapshot previously produced",
- "re-ran the same oversized-recovery load at 375x812 and confirmed identical console recovery sequence plus a populated mobile nodes list and bottom nav counters",
- "restored the 8 MiB constant, reloaded, and confirmed the console showed 'message {type: initialState, resourceCount: 265}' with no oversized warning and no /api/state recovery fetch"
]
}
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index 590c48bd6b..014a43dd5f 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -355,6 +355,24 @@ describe('settings architecture guardrails', () => {
expect(settingsAccessSource).toContain('setActiveTab(fallbackTab)');
});
+ it('gates the admin-only System tabs on the served systemSettingsRead capability', () => {
+ // Same rationale as Infrastructure rather than the paid-feature one: a free
+ // install can act on a paid tab by upgrading, but a non-admin cannot grant
+ // themselves admin, so Network / Pulse server updates / Recovery can only
+ // end in a panel they will never populate.
+ for (const id of ['system-network', 'system-updates', 'system-recovery']) {
+ const navBlock = settingsNavCatalogSource.match(
+ new RegExp(`id: '${id}',[\\s\\S]*?requiredCapability: 'systemSettingsRead',\\n\\s*},`),
+ );
+ expect(navBlock?.[0]).toBeTruthy();
+ }
+
+ // system-general carries user-scoped theme, language, and unit preferences,
+ // so gating it would take personal settings away from every non-admin.
+ const generalNavBlock = settingsNavCatalogSource.match(/id: 'system-general',[\s\S]*?\n {6}},/);
+ expect(generalNavBlock?.[0]).not.toContain('requiredCapability');
+ });
+
it('keeps the external-agent (MCP) connector setup findable from sidebar search', () => {
// The Assistant page hosts the pulse-mcp connector setup, but its label and
// copy can't carry every term users search for. The nav item's search-only
diff --git a/frontend-modern/src/components/Settings/__tests__/systemNavCapabilityGate.test.ts b/frontend-modern/src/components/Settings/__tests__/systemNavCapabilityGate.test.ts
new file mode 100644
index 0000000000..40d5dbf748
--- /dev/null
+++ b/frontend-modern/src/components/Settings/__tests__/systemNavCapabilityGate.test.ts
@@ -0,0 +1,85 @@
+import { describe, expect, it } from 'vitest';
+import { getSettingsNavItem } from '../settingsNavCatalog';
+import {
+ shouldBlockSettingsRouteItem,
+ shouldHideSettingsNavItem,
+ type SettingsNavVisibilityContext,
+} from '../settingsNavVisibility';
+
+// System → Network, Pulse server updates, and Recovery are pure instance
+// administration: the public URL and CORS boundaries, the server update
+// channel, and backup polling plus config export/import. Every route behind
+// them is RequireAdmin + settings:read, so a session without it was offered
+// three tabs it could open and never populate. This is the sibling of the
+// infrastructure-systems gate; the two capabilities share a derivation but
+// name different surfaces so tightening one cannot silently hide the other.
+
+const SYSTEM_ADMIN_TABS = ['system-network', 'system-updates', 'system-recovery'] as const;
+
+const createContext = (
+ overrides: Partial<SettingsNavVisibilityContext> = {},
+): SettingsNavVisibilityContext => ({
+ hasFeature: () => false,
+ runtimeCapabilitiesLoaded: () => true,
+ hostedModeEnabled: false,
+ ...overrides,
+});
+
+describe('admin-only System tab capability gate', () => {
+ it('declares systemSettingsRead as the required capability on each tab', () => {
+ for (const tab of SYSTEM_ADMIN_TABS) {
+ expect(getSettingsNavItem(tab)?.requiredCapability).toBe('systemSettingsRead');
+ }
+ });
+
+ it('hides the nav items and blocks their routes when the capability is withheld', () => {
+ const context = createContext({
+ settingsCapabilitiesResolved: true,
+ settingsCapabilities: { systemSettingsRead: false },
+ });
+
+ for (const tab of SYSTEM_ADMIN_TABS) {
+ expect(shouldHideSettingsNavItem(tab, context)).toBe(true);
+ expect(shouldBlockSettingsRouteItem(tab, context)).toBe(true);
+ }
+ });
+
+ it('keeps the nav items and routes for a session that holds the capability', () => {
+ const context = createContext({
+ settingsCapabilitiesResolved: true,
+ settingsCapabilities: { systemSettingsRead: true },
+ });
+
+ for (const tab of SYSTEM_ADMIN_TABS) {
+ expect(shouldHideSettingsNavItem(tab, context)).toBe(false);
+ expect(shouldBlockSettingsRouteItem(tab, context)).toBe(false);
+ }
+ });
+
+ it('does not hide the tabs before the security status resolves', () => {
+ // Hiding on an unresolved status would flash three tabs away from an admin
+ // on every load.
+ const context = createContext({
+ settingsCapabilitiesResolved: false,
+ settingsCapabilities: null,
+ });
+
+ for (const tab of SYSTEM_ADMIN_TABS) {
+ expect(shouldHideSettingsNavItem(tab, context)).toBe(false);
+ expect(shouldBlockSettingsRouteItem(tab, context)).toBe(false);
+ }
+ });
+
+ it('leaves System → General reachable without the capability', () => {
+ // Theme, language, and unit preferences there are user-scoped, so gating
+ // the tab would take personal settings away from every non-admin.
+ const context = createContext({
+ settingsCapabilitiesResolved: true,
+ settingsCapabilities: { systemSettingsRead: false },
+ });
+
+ expect(getSettingsNavItem('system-general')?.requiredCapability).toBeUndefined();
+ expect(shouldHideSettingsNavItem('system-general', context)).toBe(false);
+ expect(shouldBlockSettingsRouteItem('system-general', context)).toBe(false);
+ });
+});
diff --git a/frontend-modern/src/components/Settings/settingsNavCatalog.ts b/frontend-modern/src/components/Settings/settingsNavCatalog.ts
index b8e72e024b..0ba367de35 100644
--- a/frontend-modern/src/components/Settings/settingsNavCatalog.ts
+++ b/frontend-modern/src/components/Settings/settingsNavCatalog.ts
@@ -165,12 +165,23 @@ export const SETTINGS_NAV_GROUPS: SettingsNavGroup[] = [
iconProps: { strokeWidth: 2 },
saveBehavior: 'system',
},
+ // Network, updates, and recovery are pure instance administration - the
+ // public URL and CORS boundaries, the server update channel, backup
+ // polling and config export/import - and every route behind them is
+ // RequireAdmin + settings:read. Hidden rather than shown with an inline
+ // gate, which is the deliberate opposite of the paid-feature items in
+ // this catalog: a free install can act on a paid tab by upgrading, so
+ // hiding it costs discoverability, but a non-admin cannot grant
+ // themselves admin, so the tab can only end in a panel they will never
+ // populate. system-general above stays ungated - theme, language, and
+ // unit preferences there are user-scoped.
{
id: 'system-network',
label: 'Network',
icon: Network,
iconProps: { strokeWidth: 2 },
saveBehavior: 'system',
+ requiredCapability: 'systemSettingsRead',
},
{
id: 'system-updates',
@@ -178,6 +189,7 @@ export const SETTINGS_NAV_GROUPS: SettingsNavGroup[] = [
icon: RefreshCw,
iconProps: { strokeWidth: 2 },
saveBehavior: 'system',
+ requiredCapability: 'systemSettingsRead',
},
{
id: 'system-recovery',
@@ -185,6 +197,7 @@ export const SETTINGS_NAV_GROUPS: SettingsNavGroup[] = [
icon: Clock,
iconProps: { strokeWidth: 2 },
saveBehavior: 'system',
+ requiredCapability: 'systemSettingsRead',
},
],
},
diff --git a/frontend-modern/src/types/config.ts b/frontend-modern/src/types/config.ts
index 4c2684f875..68f13692b9 100644
--- a/frontend-modern/src/types/config.ts
+++ b/frontend-modern/src/types/config.ts
@@ -97,6 +97,13 @@ export interface NodesConfig {
*/
export interface SecurityStatusSettingsCapabilities {
infrastructureRead: boolean;
+ /**
+ * The same RequireAdmin + settings:read gate as infrastructureRead, scoped to
+ * the System > Network / Pulse server updates / Recovery tabs. A sibling
+ * rather than a reuse, so tightening one surface's gate cannot silently hide
+ * the other's tabs.
+ */
+ systemSettingsRead: boolean;
apiAccessRead: boolean;
apiAccessWrite: boolean;
authenticationRead: boolean;
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index cfca47cc78..12ea2ee43c 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -10996,6 +10996,61 @@ func TestContract_SecurityStatusInfrastructureReadTracksSettingsReadScope(t *tes
}
}
+// Sibling of the infrastructureRead contract above, for the admin-only System
+// tabs. The two share a derivation today and are still pinned separately: the
+// point of the second field is that tightening one page's gate must not
+// silently move the other page's tabs, and only a test per field can catch
+// that.
+func TestContract_SecurityStatusSystemSettingsReadTracksSettingsReadScope(t *testing.T) {
+ cases := []struct {
+ name string
+ scopes []string
+ want bool
+ }{
+ {"settings read grants the system settings tabs", []string{config.ScopeSettingsRead}, true},
+ {"monitoring read alone withholds them", []string{config.ScopeMonitoringRead}, false},
+ }
+
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ rawToken := fmt.Sprintf("contract-syssettings-scope-%s.12345678", strings.ReplaceAll(tc.name, " ", "-"))
+ record := newTokenRecord(t, rawToken, tc.scopes, nil)
+ cfg := newTestConfigWithTokens(t, record)
+ router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
+
+ req := httptest.NewRequest(http.MethodGet, "/api/security/status", nil)
+ req.Header.Set("X-API-Token", rawToken)
+ rec := httptest.NewRecorder()
+ router.Handler().ServeHTTP(rec, req)
+ if rec.Code != http.StatusOK {
+ t.Fatalf("security status = %d, want 200 (%s)", rec.Code, rec.Body.String())
+ }
+
+ var payload struct {
+ SettingsCapabilities securityStatusSettingsCapabilities `json:"settingsCapabilities"`
+ }
+ if err := json.Unmarshal(rec.Body.Bytes(), &payload); err != nil {
+ t.Fatalf("decode security status payload: %v", err)
+ }
+ if payload.SettingsCapabilities.SystemSettingsRead != tc.want {
+ t.Fatalf("settingsCapabilities.systemSettingsRead = %v, want %v",
+ payload.SettingsCapabilities.SystemSettingsRead, tc.want)
+ }
+
+ // The capability is only honest if the routes behind the tabs agree.
+ probe := httptest.NewRequest(http.MethodGet, "/api/system/settings", nil)
+ probe.Header.Set("X-API-Token", rawToken)
+ probeRec := httptest.NewRecorder()
+ router.Handler().ServeHTTP(probeRec, probe)
+ refused := probeRec.Code == http.StatusForbidden
+ if refused == tc.want {
+ t.Fatalf("GET /api/system/settings = %d, which contradicts systemSettingsRead=%v",
+ probeRec.Code, tc.want)
+ }
+ })
+ }
+}
+
func TestContract_SecurityStatusSplitsAuditLogCapabilityFromSettingsRead(t *testing.T) {
prevAuthorizer := authpkg.GetAuthorizer()
authpkg.SetAuthorizer(&allowRulesAuthorizer{
diff --git a/internal/api/security_status_capabilities.go b/internal/api/security_status_capabilities.go
index 4a5a0f3962..89a09c77c5 100644
--- a/internal/api/security_status_capabilities.go
+++ b/internal/api/security_status_capabilities.go
@@ -19,7 +19,17 @@ type securityStatusSettingsCapabilities struct {
// which needs settings:write on top). Serving it lets the nav hide a page
// that would otherwise mount 15s and 30s pollers whose every request is
// refused and logged at warn level.
- InfrastructureRead bool `json:"infrastructureRead"`
+ InfrastructureRead bool `json:"infrastructureRead"`
+ // SystemSettingsRead mirrors the same RequireAdmin + settings:read gate for
+ // the System → Network, Pulse server updates, and Recovery tabs, whose
+ // panels read and write the public URL and CORS boundaries, the server
+ // update channel, and backup polling plus config export/import. It is a
+ // sibling of InfrastructureRead rather than a reuse of it: they happen to
+ // share a derivation today, but each names the surface it describes, so
+ // tightening one gate cannot silently hide the other's tabs. System →
+ // General stays ungated - theme, language, and unit preferences there are
+ // user-scoped, not instance administration.
+ SystemSettingsRead bool `json:"systemSettingsRead"`
APIAccessRead bool `json:"apiAccessRead"`
APIAccessWrite bool `json:"apiAccessWrite"`
AuthenticationRead bool `json:"authenticationRead"`
@@ -256,6 +266,7 @@ func (r *Router) securityStatusSettingsCapabilitiesFromSnapshot(snapshot securit
return securityStatusSettingsCapabilities{
InfrastructureRead: canReadSettings,
+ SystemSettingsRead: canReadSettings,
APIAccessRead: r.canAccessPermissionSurface(snapshot, internalauth.ActionAdmin, internalauth.ResourceUsers, config.ScopeSettingsRead),
APIAccessWrite: r.canAccessPermissionSurface(snapshot, internalauth.ActionAdmin, internalauth.ResourceUsers, config.ScopeSettingsWrite),
AuthenticationRead: canReadSettings,
diff --git a/internal/api/security_status_capability_enforcement_test.go b/internal/api/security_status_capability_enforcement_test.go
index 11c13d34f1..2c0e924655 100644
--- a/internal/api/security_status_capability_enforcement_test.go
+++ b/internal/api/security_status_capability_enforcement_test.go
@@ -77,6 +77,10 @@ func TestSettingsCapabilitiesMatchRouteEnforcementWithoutRBAC(t *testing.T) {
"authenticationRead",
"authenticationWrite",
"infrastructureRead",
+ // Sibling of infrastructureRead for the admin-only System tabs. Same
+ // derivation today, but each names its own surface so tightening one
+ // gate cannot silently hide the other's tabs.
+ "systemSettingsRead",
} {
if caps[key] != false {
t.Fatalf("%s = %v for a non-admin session, want false", key, caps[key])
@@ -114,7 +118,7 @@ func TestSettingsCapabilitiesGrantConfiguredAdminWithoutRBAC(t *testing.T) {
router := NewRouter(cfg, nil, nil, nil, nil, "1.0.0")
caps := fetchSettingsCapabilities(t, router, capabilitySessionCookie(t, "admin"))
- for _, key := range []string{"apiAccessRead", "apiAccessWrite", "singleSignOnRead", "singleSignOnWrite", "infrastructureRead"} {
+ for _, key := range []string{"apiAccessRead", "apiAccessWrite", "singleSignOnRead", "singleSignOnWrite", "infrastructureRead", "systemSettingsRead"} {
if caps[key] != true {
t.Fatalf("%s = %v for the configured admin, want true", key, caps[key])
}