Plan device actions exclusively as approved scripts and provide reboot library revisions

This commit is contained in:
2026-11-18 12:04:58 +01:00
parent adc04f0148
commit cd80bfc704
31 changed files with 1014 additions and 779 deletions
+3 -5
View File
@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from 'vitest';
import { renderToStaticMarkup } from 'react-dom/server';
import { actions, PlanInput, Session, request, session, windowsMsi, windowsMsiManifest, validateInput } from './api';
import { adminIntent, allowed, availableActions, windowsMsiPlanJobs, windowsMsiApprovalBlockers, verifyWindowsMsiManifest, parseStrictJson, powerShellApprovalBlockers, powerShellPlanJobs, queryLogsApprovalBlockers, queryLogsPlanJobs, recipeInput, rootWarning, sha256, validateAptManifest, validateSensitiveInput, verifyAptManifest, verifyPlanIntegrity } from './safety';
import { PlanInput, Session, request, session, windowsMsi, windowsMsiManifest, validateInput } from './api';
import { adminIntent, allowed, windowsMsiPlanJobs, windowsMsiApprovalBlockers, verifyWindowsMsiManifest, parseStrictJson, powerShellApprovalBlockers, powerShellPlanJobs, queryLogsApprovalBlockers, queryLogsPlanJobs, recipeInput, rootWarning, sha256, validateAptManifest, validateSensitiveInput, verifyAptManifest, verifyPlanIntegrity } from './safety';
import { AdminControl } from './management';
vi.mock('react-dom/client', () => ({ createRoot: () => ({ render: vi.fn() }) }));
@@ -115,9 +115,7 @@ describe('root and dedicated dev-test APT actions', () => {
await expect(verifyPlanIntegrity({ plan_payload_bytes: Array.from(shellRaw), plan_hash: await sha256(shellRaw) })).rejects.toThrow();
await expect(validateSensitiveInput({ ...value, parameters: { ...value.parameters, execution_identity: 'root' } }, systemAuth)).rejects.toThrow('root:execute');
});
it('shows native acceptance only with explicit server simulation evidence, never upgrades identity', async () => {
expect(availableActions(auth, actions)).toContain('apt_native_acceptance');
expect(availableActions({ ...auth, principal: { ...auth.principal, simulated: false } }, actions)).not.toContain('apt_native_acceptance');
it('validates the explicit simulation and root identity of historical native acceptance input', async () => {
const value = input(await manifest());
await validateSensitiveInput(value, auth); expect(value.parameters.execution_identity).toBe('root');
await expect(validateSensitiveInput({ ...value, parameters: { ...value.parameters, execution_identity: 'agent_service' } }, auth)).rejects.toThrow('root');