Bind typed SYSTEM service plans and qualify Domain contract on cloud Linux
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-14 05:30:21 +01:00
parent 5f356a92ac
commit e85f9ed750
10 changed files with 422 additions and 17 deletions
+14
View File
@@ -65,6 +65,20 @@ describe('JSON contract boundary', () => {
expect(() => validateInput({ ...input, parameters: { ...input.parameters, execution_identity: 'root' } })).toThrow('agent_service');
validateInput({ ...input, parameters: { ...input.parameters, variants: [{ ...windows, script_utf8: "\ufeffWrite-Output 'é'\r\n" }] } });
});
it('allows SYSTEM only for exact bounded fixture SCM parameters without changing Linux restart', () => {
const input: PlanInput = { tenant_id: 't', action: 'set_service_state', targets: { asset_ids: ['asset'] }, parameters: { execution_identity: 'system', unit: 'RmmDiscoveryFixtureService', state: 'running', timeout_seconds: 30, max_output_bytes: 4096 }, schedule: { not_before: new Date().toISOString(), start_before: new Date(Date.now() + 60000).toISOString(), offline_policy: 'wait_until_deadline' }, rollout: { max_parallel: 1, halt_after_failures: 1 }, reason: 'fixed SCM plan' };
const before = JSON.stringify(input); validateInput(input); expect(JSON.stringify(input)).toBe(before);
validateInput({ ...input, parameters: { ...input.parameters, state: 'stopped' } });
for (const parameters of [
{ ...input.parameters, unit: 'Spooler' }, { ...input.parameters, unit: 'RmmDiscoveryFixture*' },
{ ...input.parameters, state: 'restarted' }, { ...input.parameters, timeout_seconds: 121 },
{ ...input.parameters, max_output_bytes: 65537 }, { ...input.parameters, script_utf8: 'whoami' },
{ ...input.parameters, execution_identity: 'SYSTEM' },
]) expect(() => validateInput({ ...input, parameters })).toThrow();
expect(() => validateInput({ ...input, action: 'refresh_inventory' })).toThrow('SYSTEM');
expect(() => validateInput({ ...input, action: 'run_script', parameters: { ...input.parameters, variants: [{ os_family: 'windows', interpreter: 'powershell', encoding: 'utf-8', script_utf8: 'whoami' }] } })).toThrow('agent_service');
validateInput({ ...input, parameters: { ...input.parameters, execution_identity: 'root', unit: 'rmm-mvp-test.service', state: 'restarted', timeout_seconds: 180 } });
});
it('accepts explicit existing dev simulation evidence but not a principal-name guess', () => {
expect(session({ principal: 'sim-test', tenant_id: 't', testsimulation: true, csrf_token: 'csrf' }).principal.simulated).toBe(true);
expect(() => session({ principal: 'sim-test', tenant_id: 't', csrf_token: 'csrf' })).toThrow();