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.

Preserve spaced SSO group mappings in settings

pulse-triage[bot]c6bc5704395d
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 77c139dd4f..2cf20966f1 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -6318,6 +6318,14 @@ or `advanced_sso` feature probe before opening the SAML provider modal.
`useSSOProvidersState.ts` must treat provider type as form state only; SSO
entitlement truth belongs to the backend/runtime capability contract, where
OIDC, SAML, and multi-provider SSO are Community-tier capabilities.
+The group-to-role mapping form must retain IdP group names with embedded
+spaces through provider detail, edit, payload, and reload. Its entries are
+comma- or newline-delimited `group=roleId` pairs; whitespace within a group
+name is not an entry separator. Keep the existing whitespace parsing for
+OIDC scopes and the other allowed lists separate from mapping parsing.
+`ssoProvidersModel.test.ts` and `SSOProvidersPanel.test.tsx` pin this round
+trip, and browser verification must inspect the saved mapping in the desktop
+and narrow edit dialog.
`frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx` must keep
page-shell titles, descriptions, and lead panel framing aligned instead of
letting navigation/header labels drift away from the actual settings surface.
diff --git a/frontend-modern/browser-tests/sso-mappings-2266.cjs b/frontend-modern/browser-tests/sso-mappings-2266.cjs
new file mode 100644
index 0000000000..11609830ac
--- /dev/null
+++ b/frontend-modern/browser-tests/sso-mappings-2266.cjs
@@ -0,0 +1,95 @@
+// #2266: prove the production SSO form keeps IdP group names with spaces.
+const assert = require('node:assert/strict');
+const path = require('node:path');
+const { chromium } = require('playwright');
+
+(async () => {
+ const root = '/workspace/frontend-modern';
+ process.chdir(root);
+ const { createServer } = await import(path.join(root, 'node_modules/vite/dist/node/index.js'));
+ const server = await createServer({
+ root,
+ configFile: path.join(root, 'vite.config.ts'),
+ server: { host: '127.0.0.1', port: 5206, strictPort: true },
+ });
+ let browser;
+ try {
+ await server.listen();
+ browser = await chromium.launch({ headless: true, channel: 'chromium', args: ['--no-sandbox'] });
+ const observations = [];
+ for (const width of [1440, 390]) {
+ let mappings = { 'Server Access': 'admin' };
+ const saves = [];
+ const errors = [];
+ const page = await browser.newPage({ viewport: { width, height: width === 390 ? 844 : 900 } });
+ page.on('pageerror', (error) => errors.push(error.message));
+ await page.route('**/*', (route) => {
+ const url = new URL(route.request().url());
+ if (url.origin !== 'http://127.0.0.1:5206') return route.abort();
+ const method = route.request().method();
+ if (url.pathname === '/api/security/sso/providers' && method === 'GET') {
+ return route.fulfill({ json: { providers: [{ id: 'corp-oidc', name: 'Corporate OIDC',
+ type: 'oidc', enabled: true, priority: 0 }], allowMultipleProviders: false } });
+ }
+ if (url.pathname === '/api/security/status') {
+ return route.fulfill({ json: { publicUrl: 'https://pulse.example.com' } });
+ }
+ if (url.pathname === '/api/security/sso/providers/corp-oidc') {
+ if (method === 'GET') return route.fulfill({ json: {
+ id: 'corp-oidc', name: 'Corporate OIDC', type: 'oidc', enabled: true,
+ oidc: { issuerUrl: 'https://idp.example.com', clientId: 'pulse',
+ scopes: ['openid', 'profile', 'email'] }, groupsClaim: 'groups',
+ groupRoleMappings: mappings,
+ } });
+ if (method === 'PUT') {
+ const payload = JSON.parse(route.request().postData());
+ mappings = payload.groupRoleMappings;
+ saves.push(payload);
+ return route.fulfill({ json: { id: 'corp-oidc' } });
+ }
+ }
+ if (url.pathname.startsWith('/api/')) return route.fulfill({ status: 404, json: {} });
+ return route.continue();
+ });
+ await page.goto('http://127.0.0.1:5206/browser-tests/sso-mappings-2266.html', {
+ waitUntil: 'domcontentloaded', timeout: 120_000,
+ });
+ await page.getByRole('button', { name: 'Edit provider' }).click();
+ await page.getByRole('button', { name: 'Show access restrictions & role mapping' }).click();
+ const input = page.getByRole('textbox', { name: 'Group Role Mappings' });
+ assert.equal(await input.inputValue(), 'Server Access=admin');
+ await input.fill('Server Access=admin,\nEveryone=viewer');
+ await page.getByRole('button', { name: 'Save Changes' }).click();
+ await page.getByRole('button', { name: 'Edit provider' }).click();
+ await page.getByRole('button', { name: 'Show access restrictions & role mapping' }).click();
+ assert.equal(await input.inputValue(), 'Server Access=admin, Everyone=viewer');
+ assert.deepEqual(mappings, { 'Server Access': 'admin', Everyone: 'viewer' });
+ assert.equal(saves.length, 1);
+ assert.deepEqual(saves[0].oidc.scopes, ['openid', 'profile', 'email']);
+ await page.getByRole('dialog').waitFor({ state: 'visible' });
+ await input.scrollIntoViewIfNeeded();
+ await input.focus();
+ await page.waitForTimeout(350);
+ const dialogBox = await page.getByRole('dialog').boundingBox();
+ const mappingBox = await input.boundingBox();
+ assert.ok(dialogBox && mappingBox && mappingBox.y >= dialogBox.y &&
+ mappingBox.y + mappingBox.height <= dialogBox.y + dialogBox.height,
+ `mapping input clipped outside dialog at ${width}px: ${JSON.stringify({ dialogBox, mappingBox })}`);
+ await page.screenshot({ path: path.join(root, 'browser-tests', `sso-mappings-2266-${width}.png`),
+ fullPage: true });
+ const dimensions = await page.evaluate(() => ({ scroll: document.documentElement.scrollWidth,
+ inner: window.innerWidth }));
+ assert.ok(dimensions.scroll <= dimensions.inner + 1,
+ `${width}px horizontal overflow: ${JSON.stringify(dimensions)}`);
+ await page.keyboard.press('Escape');
+ assert.equal(await page.getByRole('textbox', { name: 'Group Role Mappings' }).count(), 0);
+ assert.deepEqual(errors, []);
+ observations.push({ width, dimensions, saves: saves.length, mapping: mappings });
+ await page.close();
+ }
+ console.log(JSON.stringify({ result: 'passed', browser: browser.version(), observations }));
+ } finally {
+ if (browser) await browser.close();
+ await server.close();
+ }
+})().catch((error) => { console.error(error); process.exitCode = 1; });
diff --git a/frontend-modern/browser-tests/sso-mappings-2266.html b/frontend-modern/browser-tests/sso-mappings-2266.html
new file mode 100644
index 0000000000..f2dbf62b6e
--- /dev/null
+++ b/frontend-modern/browser-tests/sso-mappings-2266.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html lang="en">
+ <head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="/browser-tests/sso-mappings-2266.tsx"></script>
+ </body>
+</html>
diff --git a/frontend-modern/browser-tests/sso-mappings-2266.tsx b/frontend-modern/browser-tests/sso-mappings-2266.tsx
new file mode 100644
index 0000000000..a6b760ff44
--- /dev/null
+++ b/frontend-modern/browser-tests/sso-mappings-2266.tsx
@@ -0,0 +1,10 @@
+// Mount the production SSO settings panel; the browser proof replaces only its API.
+import { render } from 'solid-js/web';
+import { SSOProvidersPanel } from '../src/components/Settings/SSOProvidersPanel';
+import '../src/index.css';
+
+render(() => (
+ <main class="mx-auto max-w-5xl p-4">
+ <SSOProvidersPanel />
+ </main>
+), document.getElementById('root')!);
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 0c8ed6c767..e5e7e94fc1 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,22 +1,18 @@
{
"version": 1,
- "base_sha": "27036a244550f3095aa883a74716374107aaa6cd",
- "verified_at": "2026-09-26T17:36:07Z",
+ "base_sha": "e3b1e80c9329bb897d37f82c1ff190a4c95dc9b3",
+ "verified_at": "2026-09-26T19:03:18Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx",
- "frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx",
- "frontend-modern/src/hooks/useWorkloads.ts",
- "frontend-modern/src/types/workloads.ts"
+ "frontend-modern/src/components/Settings/SSOProvidersPanel.tsx",
+ "frontend-modern/src/components/Settings/ssoProvidersModel.ts"
],
"content_sha256": {
- "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx": "f4f8903e442d92a622fa2517f54288fb0dfa97882136e268e8e0f540390127fe",
- "frontend-modern/src/components/Workloads/GuestPhysicalDisks.tsx": "9640df56a51dbf27247613324a4f3fe1b4023e93d4a1efa913e234453acfd270",
- "frontend-modern/src/hooks/useWorkloads.ts": "0b3ae83f83d2df3e2517d552f51b634e0eedecbfbd1756a2dadd834c81c67bd2",
- "frontend-modern/src/types/workloads.ts": "4d779f40a56b83b83c8bbcb4b49f88e1db3432d071b8f6326094fa081547c1e6"
+ "frontend-modern/src/components/Settings/SSOProvidersPanel.tsx": "781cbb8913f42008456afa7701351c4828aabc140c9e35595c47fd2330bca0cf",
+ "frontend-modern/src/components/Settings/ssoProvidersModel.ts": "9f10845e553633d73bff7ac5fb295d4ce5cc0c4250d0eef1bac2ce18bb31ef2c"
},
"routes": [
- "/browser-tests/guest-storage-2263.html"
+ "/browser-tests/sso-mappings-2266.html"
],
"viewports": [
{
@@ -29,19 +25,15 @@
}
],
"states": [
- "Production guest Overview mounted with synthetic agent-linked VM, one guest SMART disk and mdadm RAID; fixture also returns an unrelated host disk to check parent isolation",
- "Guest SMART disclosure collapsed and keyboard-expanded; health, temperature and counters visible",
- "Uninstrumented VM: no physical-disk card and no child query",
- "Child-query HTTP 503: visible unavailable status, no misleading empty card",
- "Desktop and phone screenshots inspected; no horizontal overflow or browser page errors"
+ "Existing OIDC provider loaded with Server Access=admin from provider detail; edit dialog access restrictions opened",
+ "Mapping edited to add Everyone=viewer on a new line, saved by PUT, reopened from provider detail as Server Access=admin, Everyone=viewer",
+ "Desktop and phone screenshots inspected with the mapping field focused and visible; no clipping or horizontal overflow"
],
"interactions": [
- "Load current Vite source build in Chromium and inspect the linked guest Overview at 1440px and 390px",
- "Focus the physical-disk summary and press Enter; inspect rendered SMART counters and adjacent RAID card",
- "Select No agent and verify that no physical-disk request or card is made",
- "Select Unavailable query and verify the explicit error status with no disk card",
- "Assert both requests use type=physical_disk and exact canonical parent ID, never the VMID/table ID; reject unrelated host disk in client display"
+ "Open production SSOProvidersPanel edit dialog and expand access restrictions at both widths",
+ "Edit the deepest Group Role Mappings textarea, save, and reopen to verify persisted multi-word group; assert unchanged OIDC scope list",
+ "Scroll and focus the mapping field within the dialog; inspect its bounding box and rendered pixels, then close with Escape"
],
- "command": "pulse-worker-browser frontend-modern/browser-tests/guest-storage-2263.cjs (Playwright 1.56.1, Chromium 141.0.7390.37)",
- "notes": "Synthetic network fixture mounts production GuestDrawerOverview, GuestPhysicalDisks, RaidCard and useUnifiedResources in Vite; it does not prove installed Proxmox data, full-app navigation, release placement or reporter confirmation. Screenshots and browser command output retained in the lane output directory."
+ "command": "pulse-worker-browser frontend-modern/browser-tests/sso-mappings-2266.cjs (Playwright 1.56.1, Chromium 141.0.7390.37)",
+ "notes": "Synthetic API fixture around the production panel; no live Cloudflare/Google Workspace sign-in, installed instance, containing release or reporter confirmation is claimed. Screenshots and browser log are retained in the lane output directory."
}
diff --git a/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx b/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
index f5cc13eda0..3363dfbc78 100644
--- a/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
+++ b/frontend-modern/src/components/Settings/SSOProvidersPanel.tsx
@@ -774,7 +774,7 @@ export const SSOProvidersPanel: Component<SSOProvidersPanelProps> = (props) => {
onInput={(e) => setForm('groupRoleMappings', e.currentTarget.value)}
placeholder="admins=admin, ops=operator"
textareaBaseClass={controlClass('min-h-[60px]')}
- help="Format: group=roleId"
+ help="Format: group=roleId. Separate mappings with commas or new lines. Group names may contain spaces."
/>
</div>
</div>
diff --git a/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx b/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx
index d61cc44a50..66e6a026f5 100644
--- a/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx
+++ b/frontend-modern/src/components/Settings/__tests__/SSOProvidersPanel.test.tsx
@@ -51,7 +51,7 @@ const corpProviderDetails = {
groupRoleMappings: { admins: 'admin' },
};
-const setupFetch = (providers: unknown[]) => {
+const setupFetch = (providers: unknown[], providerDetails: unknown = corpProviderDetails) => {
fetchMock.mockImplementation((url: string, options?: RequestInit) => {
const method = (options?.method ?? 'GET').toUpperCase();
if (url === '/api/security/sso/providers' && method === 'GET') {
@@ -61,7 +61,7 @@ const setupFetch = (providers: unknown[]) => {
return Promise.resolve(jsonResponse({ publicUrl: 'https://pulse.example.com' }));
}
if (url === '/api/security/sso/providers/corp-oidc' && method === 'GET') {
- return Promise.resolve(jsonResponse(corpProviderDetails));
+ return Promise.resolve(jsonResponse(providerDetails));
}
if (method === 'POST' || method === 'PUT') {
return Promise.resolve(jsonResponse({ id: 'corp-oidc' }));
@@ -137,6 +137,57 @@ describe('SSOProvidersPanel OIDC scopes', () => {
});
});
+describe('SSOProvidersPanel OIDC group role mappings', () => {
+ beforeEach(() => {
+ fetchMock.mockReset();
+ notificationSuccessMock.mockReset();
+ notificationErrorMock.mockReset();
+ loggerErrorMock.mockReset();
+ loggerWarnMock.mockReset();
+ vi.stubGlobal('fetch', fetchMock);
+ document.cookie = 'pulse_csrf=test-csrf-token';
+ });
+
+ afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ });
+
+ it('preserves a multi-word group from provider details through the edit form and PUT', async () => {
+ setupFetch([corpProvider], {
+ ...corpProviderDetails,
+ groupRoleMappings: { 'Server Access': 'admin' },
+ });
+ render(() => <SSOProvidersPanel />);
+
+ fireEvent.click(await screen.findByRole('button', { name: 'Edit provider' }));
+ fireEvent.click(
+ await screen.findByRole('button', { name: 'Show access restrictions & role mapping' }),
+ );
+
+ const mappings = screen.getByRole('textbox', {
+ name: 'Group Role Mappings',
+ }) as HTMLTextAreaElement;
+ expect(mappings.value).toBe('Server Access=admin');
+ fireEvent.input(mappings, { target: { value: 'Server Access=admin,\nEveryone=viewer' } });
+
+ const saveButton = screen.getByRole('button', { name: 'Save Changes' });
+ fireEvent.submit(saveButton.closest('form')!);
+
+ await waitFor(() => {
+ const saveCall = fetchMock.mock.calls.find(
+ ([url, options]) =>
+ url === '/api/security/sso/providers/corp-oidc' &&
+ (options as RequestInit | undefined)?.method === 'PUT',
+ );
+ expect(saveCall).toBeTruthy();
+ const body = JSON.parse((saveCall![1] as RequestInit).body as string);
+ expect(body.groupRoleMappings).toEqual({ 'Server Access': 'admin', Everyone: 'viewer' });
+ expect(body.oidc.scopes).toEqual(['openid', 'profile', 'email', 'groups']);
+ });
+ });
+});
+
describe('SSOProvidersPanel IdP endpoint URLs', () => {
beforeEach(() => {
fetchMock.mockReset();
diff --git a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
index f1129cb2a4..7583fce747 100644
--- a/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts
@@ -98,6 +98,7 @@ import rbacFeatureGateStateSource from '../useRBACFeatureGateState.ts?raw';
import reportingStateSource from '../useReportingPanelState.ts?raw';
import ssoProvidersPanelSource from '../SSOProvidersPanel.tsx?raw';
import ssoProvidersStateSource from '../useSSOProvidersState.ts?raw';
+import ssoProvidersModelSource from '../ssoProvidersModel.ts?raw';
import useInfrastructureInstallStateSource from '../useInfrastructureInstallState.tsx?raw';
import useInfrastructureConfiguredNodesStateSource from '../useInfrastructureConfiguredNodesState.ts?raw';
import useInfrastructureSettingsStateSource from '../useInfrastructureSettingsState.ts?raw';
@@ -1207,6 +1208,12 @@ describe('settings architecture guardrails', () => {
expect(ssoProvidersStateSource).not.toContain('loadRuntimeCapabilities');
});
+ it('separates SSO mapping entries without splitting spaces inside IdP group names', () => {
+ expect(ssoProvidersModelSource).toContain('input.split(/[,\\r\\n]+/)');
+ expect(ssoProvidersModelSource).not.toContain('splitList(input).forEach');
+ expect(ssoProvidersPanelSource).toContain('Group names may contain spaces.');
+ });
+
it('never offers a localhost SSO endpoint URL as if it were registerable with an IdP', () => {
// The panel tells admins to register these URLs with their IdP, so a
// hardcoded localhost guess would be copied out and fail at the IdP. The
diff --git a/frontend-modern/src/components/Settings/__tests__/ssoProvidersModel.test.ts b/frontend-modern/src/components/Settings/__tests__/ssoProvidersModel.test.ts
index c008aac6ef..41ac3ec230 100644
--- a/frontend-modern/src/components/Settings/__tests__/ssoProvidersModel.test.ts
+++ b/frontend-modern/src/components/Settings/__tests__/ssoProvidersModel.test.ts
@@ -32,6 +32,32 @@ describe('ssoProvidersModel', () => {
});
});
+ it('keeps multi-word OIDC group names through save and edit without changing scope lists', () => {
+ const saved = {
+ id: 'corp-oidc',
+ name: 'Corporate OIDC',
+ type: 'oidc' as const,
+ enabled: true,
+ oidc: { scopes: ['openid', 'profile', 'email'] },
+ groupRoleMappings: { 'Server Access': 'admin', Everyone: 'viewer' },
+ };
+ const form = mapProviderDetailsToForm(saved);
+ expect(form.groupRoleMappings).toBe('Server Access=admin, Everyone=viewer');
+
+ const payload = buildProviderPayload({
+ ...form,
+ groupRoleMappings: ' Server Access = admin,\n Everyone = viewer ',
+ allowedGroups: 'admins operators',
+ });
+ expect(payload.groupRoleMappings).toEqual({ 'Server Access': 'admin', Everyone: 'viewer' });
+ expect(payload.allowedGroups).toEqual(['admins', 'operators']);
+ expect((payload.oidc as Record<string, unknown>).scopes).toEqual([
+ 'openid',
+ 'profile',
+ 'email',
+ ]);
+ });
+
it('serializes custom OIDC scopes into the provider payload', () => {
const form = {
...createEmptyProviderForm(),
diff --git a/frontend-modern/src/components/Settings/ssoProvidersModel.ts b/frontend-modern/src/components/Settings/ssoProvidersModel.ts
index 885501ae21..82102d5318 100644
--- a/frontend-modern/src/components/Settings/ssoProvidersModel.ts
+++ b/frontend-modern/src/components/Settings/ssoProvidersModel.ts
@@ -175,7 +175,9 @@ export const mappingsToString = (mappings?: Record<string, string>) =>
export const stringToMappings = (input: string) => {
const result: Record<string, string> = {};
- splitList(input).forEach((pair) => {
+ // A group name can contain spaces. Unlike scopes and allowed lists, mappings
+ // are separated only by commas or newlines, as shown by mappingsToString.
+ input.split(/[,\r\n]+/).forEach((pair) => {
const [key, value] = pair.split('=').map((segment) => segment.trim());
if (key && value) {
result[key] = value;