Add gated agent update planning, preserved handoff and Linux worker ports
Rust development slice / linux (push) Failing after 6s

This commit is contained in:
2026-11-14 21:48:21 +01:00
parent dc9cb1b096
commit 1e89c4577f
82 changed files with 25052 additions and 69 deletions
+11
View File
@@ -1,4 +1,5 @@
import { Action, PlanInput, RecordValue, Session, planTargetPreviews, record, text, validateSystemService, windowsScriptProfile, logWindow, validateWindowsLogLimits, windowsEventLogFixtureSource, windowsEventLogFixtureChannel, windowsEventLogFixtureProvider, WindowsMsiManifest, MsiPostcondition, windowsMsi, windowsMsiManifest, windowsMsiAction, validateWindowsMsiInput, validateWindowsMsiLimits, msiUuid, fullMaintenanceScriptProfile, privilegedScriptProfile, validateScriptIdentityProfile } from './api';
import { validateAgentUpdateAction } from './agent-updates';
export const hashPattern = /^[0-9a-f]{64}$/;
export const rootWarning = 'HOHES RISIKO: root kann das Zielsystem verändern. Keine automatische Rechteerhöhung; eigener expliziter Plan, Scope, Helper und Genehmigung erforderlich.';
@@ -73,6 +74,11 @@ export function validateAptManifest(value: unknown, acceptance: boolean): Record
}
export async function verifyAptManifest(value: unknown, acceptance: boolean) { const m = validateAptManifest(value, acceptance); if (await sha256(bytes(m.transaction_bytes)) !== m.transaction_sha256) throw new Error('APT Transaktionshash stimmt nicht überein'); }
export async function validateSensitiveInput(input: PlanInput, auth: Session) {
if (input.action === 'update_agent') {
if (!allowed(auth, 'updates:apply') || !['root', 'system'].includes(String(input.parameters.execution_identity))
|| !allowed(auth, input.parameters.execution_identity === 'root' ? 'root:execute' : 'system:execute')) throw new Error('Agentupdate: updates:apply und getrennte Root-/SYSTEM-Rechte erforderlich');
return;
}
if (input.action === 'run_script' && privilegedScriptProfile(input.parameters, input.parameters.execution_identity) === fullMaintenanceScriptProfile && !allowed(auth, 'scripts:execute')) throw new Error('scripts:execute für Vollwartung unbekannt oder nicht erteilt');
if (input.parameters.execution_identity === 'root' && !allowed(auth, 'root:execute')) throw new Error('root:execute unbekannt oder nicht erteilt; keine Rechteerhöhung');
if (input.parameters.execution_identity === 'system') {
@@ -356,6 +362,11 @@ export async function verifyPlanIntegrity(plan: RecordValue) {
}
for (const payload of systemJobs) {
const action = record(payload.action);
if (action.action === 'update_agent') {
validateAgentUpdateAction(action, payload.execution_identity);
if (payload.max_runtime_seconds !== 600 || typeof payload.max_output_bytes !== 'number' || !Number.isSafeInteger(payload.max_output_bytes) || payload.max_output_bytes < 1 || payload.max_output_bytes > 65536) throw new Error('SYSTEM-Agentupdate benötigt festes600s/64KiB-Budget');
continue;
}
if (isMsi(payload)) continue; // Fully validated, hash-bound package projection above.
if (action.action === 'run_script') {
validateScriptIdentityProfile(action, payload.execution_identity, action.interpreter);