Enforce customer boundaries on token administration and finalize fleet navigation

This commit is contained in:
2026-11-17 22:05:44 +01:00
parent 0afaca1d64
commit 312da6f39e
25 changed files with 1207 additions and 208 deletions
+1
View File
@@ -29,6 +29,7 @@ const assert = (value, code) => { if (!value) throw new Error(code || 'UI contra
const session = await (await sessionResponse).json();
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === 'simulated-testprincipal-a', 'SESSION');
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: operationId, exact: true }).click();
await page.getByRole('button', { name: `Job ${jobId} · unknown`, exact: true }).click();
const job = page.locator('article').filter({ has: page.getByRole('heading', { name: `Job ${jobId}`, exact: true }) });
+1
View File
@@ -49,6 +49,7 @@ function checkWindowsHello(job, planBytes) {
const session = await (await sessionResponse).json();
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === expected.expected_principal);
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await op.locator('pre').first().innerText());
+5 -1
View File
@@ -62,6 +62,8 @@ function checkAction(p, expected) {
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
if (expected.phase === 'prepare') {
await page.getByRole('checkbox', { name: 'Ziel ' + 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(expected.request.action);
await page.getByLabel('Aktionsparameter', { exact: true }).fill(JSON.stringify(expected.request.parameters));
await page.getByLabel('Ausführungsidentität', { exact: true }).selectOption('root');
@@ -83,7 +85,9 @@ function checkAction(p, expected) {
assert(path.dirname(path.resolve(expected.output_file)) === path.dirname(file));
fs.writeFileSync(expected.output_file, JSON.stringify({ plan, operation }), { flag: 'wx', mode: 0o600 });
} else {
assert(expected.phase === 'approve'); await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
assert(expected.phase === 'approve');
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await op.locator('pre').first().innerText());
assert(pending.approval_state === 'pending_approval' && pending.job_count === 0 && pending.execution_state === null);
+3
View File
@@ -39,6 +39,8 @@ function readPrivate(file) {
if (expected.phase === 'prepare') {
assert(expected.request.parameters.variants[0].script_utf8 === script && expected.request.parameters.expected_stdout === null);
await page.getByRole('checkbox', { name: 'Ziel ' + 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('run_script');
await page.getByRole('combobox', { name: 'Interpreter', exact: true }).selectOption('posix_sh');
await page.getByLabel('Exakte UTF-8 Skriptbytes', { exact: false }).fill(script);
@@ -65,6 +67,7 @@ function readPrivate(file) {
fs.writeFileSync(expected.output_file, JSON.stringify({ plan, operation }), { flag: 'wx', mode: 0o600 });
} else {
assert(expected.phase === 'approve');
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await op.locator('pre').first().innerText());
@@ -53,6 +53,8 @@ function checkJob(plan, expected, script) {
assert(expected.request.parameters.variants.length === 1 && expected.request.parameters.variants[0].script_utf8 === script
&& expected.request.parameters.expected_stdout === 'RMM_CRASH_COUNT=1\n');
await page.getByRole('checkbox', { name: 'Ziel ' + 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('run_script');
await page.getByRole('combobox', { name: 'Interpreter', exact: true }).selectOption('posix_sh');
await page.getByLabel('Exakte UTF-8 Skriptbytes', { exact: false }).fill(script);
@@ -77,6 +79,7 @@ function checkJob(plan, expected, script) {
fs.writeFileSync(expected.output_file, JSON.stringify({ plan, operation: pending }), { flag: 'wx', mode: 0o600 });
} else {
assert(expected.phase === 'approve');
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const operation = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await operation.locator('pre').first().innerText());
@@ -47,6 +47,7 @@ function counterScript(id, readOnly) {
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation'
&& session.principal === expected.expected_principal);
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const operation = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await operation.locator('pre').first().innerText());
+14 -7
View File
@@ -28,20 +28,27 @@ function readPrivate(file) {
const session = await (await response).json();
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === expected.expected_principal && session.permissions.includes('devices:revoke'));
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
assert(await page.getByLabel('Mandant', { exact: true }).inputValue() === expected.tenant_id);
await page.getByRole('button', { name: expected.asset_id, exact: true }).click();
const article = page.locator('article').filter({ has: page.getByRole('heading', { name: 'Inventardetail ' + expected.asset_id, exact: true }) });
await article.locator('pre').waitFor(); const device = JSON.parse(await article.locator('pre').innerText());
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
assert(await page.getByLabel('Kunde', { exact: true }).inputValue() === expected.tenant_id);
const row = page.getByRole('row').filter({ has: page.getByLabel('Ziel ' + expected.asset_id, { exact: true }) });
await row.getByRole('button').click();
const article = page.locator('.device-detail');
await article.getByText('Technische Daten', { exact: true }).click();
const device = JSON.parse(await article.getByLabel('Vollständiges Geräteinventar', { exact: true }).innerText());
assert(device.agent_id === expected.agent_id && device.asset_id === expected.asset_id && device.presence === 'online');
assert(device.capabilities.length === 2 && device.capabilities.includes('linux.base/1') && device.capabilities.includes('heartbeat/1'));
const control = article.locator('details').filter({ has: page.locator('summary').filter({ hasText: /^Geräteidentität widerrufen$/ }) });
await control.locator('summary').click();
await article.getByText('Gerät verwalten', { exact: true }).click();
const summary = article.locator('summary').filter({ hasText: /^Geräteidentität widerrufen$/ });
await summary.click();
const control = summary.locator('..');
await control.getByLabel('Grund für Geräteidentität widerrufen', { exact: true }).fill('Native passive Linux MVP lifecycle acceptance; revoke only this separate nonexecuting test identity');
const nonce = await control.locator('code').innerText();
await control.getByLabel('Bestätigungskennung eingeben', { exact: true }).fill(nonce);
await control.getByRole('checkbox', { name: 'Ich bestätige diese konkrete administrative Wirkung ausdrücklich.' }).check();
const revocation = page.waitForResponse(r => new URL(r.url()).pathname === '/api/v1/tenants/' + expected.tenant_id + '/devices/' + expected.asset_id + '/revocation' && r.request().method() === 'POST');
await control.getByRole('button', { name: 'Geräteidentität widerrufen · ausdrücklich ausführen', exact: true }).click();
await control.locator('pre').filter({ hasText: '"revoked": true' }).waitFor();
const result = await revocation;
assert(result.ok() && (await result.json()).revoked === true);
assert(revocations === 1 && approvals === 0);
await page.getByRole('button', { name: 'Abmelden', exact: true }).click();
} finally { await browser.close(); }
+3 -1
View File
@@ -28,7 +28,9 @@ function privateJson(file) {
const session = await (await sessionResponse).json();
assert(session.testsimulation === true && session.principal === 'simulated-testprincipal-a');
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
assert.equal(await page.getByLabel('Mandant', { exact: true }).inputValue(), expected.tenant_id);
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
assert.equal(await page.getByLabel('Kunde', { exact: true }).inputValue(), expected.tenant_id);
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const response = page.waitForResponse(r => new URL(r.url()).pathname === `/api/v1/tenants/${expected.tenant_id}/jobs/${expected.job_id}` && r.status() === 200);
+3 -1
View File
@@ -37,7 +37,9 @@ function counterScript(id) {
const session = await (await response).json();
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === expected.expected_principal);
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
assert(await page.getByLabel('Mandant', { exact: true }).inputValue() === expected.tenant_id);
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
assert(await page.getByLabel('Kunde', { exact: true }).inputValue() === expected.tenant_id);
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const operation = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const state = JSON.parse(await operation.locator('pre').first().innerText());
+5 -1
View File
@@ -43,7 +43,8 @@ function checkPlan(plan, expected) {
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation'
&& session.principal === expected.expected_principal);
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
assert(await page.getByLabel('Mandant', { exact: true }).inputValue() === expected.tenant_id);
await page.getByLabel('Kunde', { exact: true }).selectOption(expected.tenant_id);
assert(await page.getByLabel('Kunde', { exact: true }).inputValue() === expected.tenant_id);
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
if (expected.phase === 'prepare') {
const request = expected.request;
@@ -52,6 +53,8 @@ function checkPlan(plan, expected) {
&& equal(request.parameters, { reason, dependency_group: 'single-test-vm', reconnect_timeout_seconds: 180,
execution_identity: 'root', timeout_seconds: 240, max_output_bytes: 65536 }));
await page.getByRole('checkbox', { name: 'Ziel ' + 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('reboot');
await page.getByLabel('Aktionsparameter', { exact: true }).fill(JSON.stringify(request.parameters));
await page.getByLabel('Ausführungsidentität', { exact: true }).selectOption('root');
@@ -71,6 +74,7 @@ function checkPlan(plan, expected) {
assert(path.dirname(path.resolve(expected.output_file)) === path.dirname(file));
fs.writeFileSync(expected.output_file, JSON.stringify({ plan, operation: pending }), { flag: 'wx', mode: 0o600 });
} else {
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const operation = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await operation.locator('pre').first().innerText());
+1
View File
@@ -52,6 +52,7 @@ function checkWindowsScript(job, planBytes, expected) {
const session = await (await sessionResponse).json();
assert(session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation' && session.principal === expected.expected_principal);
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
await page.getByRole('link', { name: 'Aufträge', exact: true }).click();
await page.getByRole('button', { name: expected.operation_id, exact: true }).click();
const op = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Antrag / Ausführung ' + expected.operation_id, exact: true }) });
const pending = JSON.parse(await op.locator('pre').first().innerText());
@@ -43,7 +43,8 @@ const sha = value => crypto.createHash('sha256').update(value).digest('hex');
const session = await (await sessionResponse).json();
assert(session.principal === 'simulated-testprincipal-a' && session.testsimulation === true && session.approval_origin === 'dev_test_browser_simulation');
await page.getByRole('status').filter({ hasText: 'SIMULIERT' }).waitFor();
await page.getByRole('row').filter({ hasText: 'a176520e-8a91-4e93-a78b-8e7620f430e0' }).getByRole('button').click();
await page.getByRole('row').filter({ has: page.getByLabel('Ziel a176520e-8a91-4e93-a78b-8e7620f430e0', { exact: true }) }).getByRole('button').click();
await page.getByText('Entwicklungsabnahmen', { exact: true }).click();
const section = page.getByRole('region', { name: 'Administrativer SYSTEM-Nichtstartabschluss 221', exact: true });
await section.waitFor();
if (mode === 'submit') {