Organize device inventory by customer and restrict token access to its audience

This commit is contained in:
2026-11-17 21:55:24 +01:00
parent aeb9adc649
commit 0afaca1d64
39 changed files with 1950 additions and 225 deletions
+2
View File
@@ -19,6 +19,8 @@ test('dev/test browser simulation: login → fixed plan → pending → explicit
await expect(page.getByRole('status')).toContainText('SIMULIERT');
await expect(page.getByRole('status')).toContainText('kein menschlicher Produktions-Freigabenachweis');
await page.getByRole('checkbox', { name: `Ziel ${asset}`, exact: true }).check();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('link', { name: 'Auftrag planen', exact: true }).click();
await page.getByLabel('Exakte UTF-8 Skriptbytes', { exact: false }).fill("printf '%s\\n' 'Hello World'\n");
await page.getByLabel('Erwartete stdout-Ausgabe', { exact: false }).fill('Hello World\n');
await page.getByLabel('Begründung', { exact: true }).fill('Dev/test browser simulation · Hello World');
+1 -1
View File
@@ -17,6 +17,6 @@ test('real TLS login follows announced configuration and restores session withou
if (!config.dev_login_enabled) { await expect(page.locator('input[type="password"]')).toHaveCount(0); return; }
await expect(page.getByText('DEV/TEST · SIMULIERTER TESTPRINCIPAL', { exact: false })).toBeVisible();
await login(page); await page.reload(); await expect(page.getByRole('status')).toContainText('SIMULIERT');
await expect(page.getByRole('heading', { name: 'Mitgliedschaft und Ausführungsstopp' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Geräte', exact: true })).toBeVisible();
await page.getByRole('button', { name: 'Abmelden', exact: true }).click(); await expect(page.getByRole('button', { name: 'Anmelden', exact: true })).toBeVisible();
});
+5
View File
@@ -7,10 +7,15 @@ test('real dev browser membership/catalog read and administrative controls stay
page.on('request', r => { if (r.method() === 'POST' && !['/auth/dev/login', '/auth/logout'].includes(new URL(r.url()).pathname)) mutations++; });
const catalog = page.waitForResponse(r => new URL(r.url()).pathname.endsWith('/package-recipes'));
await test.step('management:login-banner', async () => { await login(page); await expect(page.getByRole('status')).toContainText('SIMULIERT'); });
await page.getByRole('link', {name:'Verwaltung',exact:true}).click();
await page.getByRole('link', {name:'Paketkataloge',exact:true}).click();
await test.step('management:catalog-response', async () => { expect((await catalog).status()).toBe(200); });
await test.step('management:catalog-heading', async () => { await expect(page.getByRole('heading', { name: 'Unveränderlicher Paketkatalog und Artefakte' })).toBeVisible(); });
await page.getByRole('link', {name:'Rechte & Ausführungsstopp',exact:true}).click();
await test.step('management:membership-heading', async () => { await expect(page.getByRole('heading', { name: 'Mitgliedschaft und Ausführungsstopp' })).toBeVisible(); });
await test.step('management:unknown-stop', async () => { await expect(page.getByText('unknown — kein lesender Stopstatus-Endpunkt angekündigt', { exact: false })).toBeVisible(); });
await page.getByRole('link', {name:'Aufträge',exact:true}).click();
await page.getByRole('link', {name:'Auftrag planen',exact:true}).click();
await test.step('management:action-option', async () => { await expect(page.getByLabel('Aktion', { exact: true }).locator('option[value="apt_native_acceptance"]')).toHaveCount(1); });
await test.step('management:select-native', async () => { await page.getByLabel('Aktion', { exact: true }).selectOption('apt_native_acceptance'); });
await test.step('management:native-hint', async () => { await expect(page.getByText('NUR SIMULIERTE DEV/TEST-NATIVABNAHME.', { exact: false })).toBeVisible(); });
+5 -2
View File
@@ -34,8 +34,10 @@ test('simulated human prepares root request through UI only, without approving',
const session = object(await (await sessionResponse).json());
expect(session.testsimulation).toBe(true); expect(session.principal).toBe(expected.expected_principal);
expect(session.approval_origin).toBe('dev_test_browser_simulation');
await expect(page.getByLabel('Mandant', { exact: true })).toHaveValue(text(expected.tenant_id));
await page.getByRole('combobox', { name: 'Kunde', exact: true }).selectOption(text(expected.tenant_id));
await page.getByRole('checkbox', { name: `Ziel ${text(expected.asset_id)}`, exact: true }).check();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('link', { name: 'Auftrag planen', exact: true }).click();
await page.getByLabel('Aktion', { exact: true }).selectOption(text(request.action));
if (request.action === 'run_script') {
const variants = params.variants;
@@ -93,8 +95,9 @@ test('one opted-in immutable dev/test action: inspect all fixed bytes → UI cli
expect(session.testsimulation).toBe(true);
expect(session.approval_origin).toBe('dev_test_browser_simulation');
expect(session.principal).toBe(expected.expected_principal);
await expect(page.getByLabel('Mandant', { exact: true })).toHaveValue(text(expected.tenant_id));
await page.getByRole('combobox', { name: 'Kunde', exact: true }).selectOption(text(expected.tenant_id));
const operation = text(expected.operation_id);
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: operation, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: `Antrag / Ausführung ${operation}`, exact: true }) });
await expect(op.locator('p.warning')).toContainText('Antrag: pending_approval');
+3 -1
View File
@@ -17,11 +17,13 @@ test('real TLS UI: login, tenant, fixed preview, pending, reload, CSRF denial an
let authorizationRequests = 0;
page.on('request', r => { if (new URL(r.url()).pathname.endsWith('/authorizations')) authorizationRequests++; });
await login(page);
await expect(page.getByLabel('Mandant', { exact: true })).not.toHaveValue('');
await expect(page.getByRole('heading', { name: 'Geräte', exact: true })).toBeVisible();
const cookies = await context.cookies();
const authCookie = cookies.find(c => c.name === '__Host-rmm_session');
expect(authCookie?.httpOnly).toBe(true); expect(authCookie?.secure).toBe(true); expect(authCookie?.sameSite).toBe('Strict');
await page.getByRole('checkbox', { name: `Ziel ${asset}`, exact: true }).check();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('link', { name: 'Auftrag planen', exact: true }).click();
await page.getByLabel('Exakte UTF-8 Skriptbytes', { exact: false }).fill("printf '%s\\n' 'Hello World'\n");
await page.getByLabel('Erwartete stdout-Ausgabe', { exact: false }).fill('Hello World\n');
await page.getByLabel('Begründung', { exact: true }).fill('Authenticated synthetic local fixture · pending-only browser contract; do not execute');
+1
View File
@@ -8,6 +8,7 @@ test('preserved real VM: pending fixed Hello World → UI click → confirmed re
const operation = process.env.RMM_E2E_OPERATION_ID;
if (!asset || !operation) throw new Error('Fixed VM asset and existing pending operation required');
await login(page);
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: operation, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: `Antrag / Ausführung ${operation}`, exact: true }) });
await expect(op.locator('p.warning')).toContainText('Antrag: pending_approval');