Deploy scoped SYSTEM nonstart review and record preserved native rollback
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
+2
-1
@@ -9,6 +9,7 @@ import { RecoveryReview, recoveryAsset, recoveryTenant } from './recovery-review
|
||||
import { EchoProbeReview } from './echo-probe-review';
|
||||
import { EchoCompletionReview } from './echo-completion-review';
|
||||
import { SyncAlignmentReview } from './sync-alignment-review';
|
||||
import { SystemNonstartReview } from './system-nonstart-review';
|
||||
import { Login } from './login';
|
||||
import { ConsoleOutput, outputText } from './console-output';
|
||||
import { scriptApprovalBlockers, scriptPlanJobs, verifyScriptPlan } from './script-console';
|
||||
@@ -114,7 +115,7 @@ function Devices({ tenantId, auth, selected, setSelected }: { tenantId: string;
|
||||
<p>Fester Auswahlsnapshot ({selected.length}): {selected.join(', ') || 'keine Ziele'}</p>
|
||||
{asset && <article><h3>Inventardetail {asset}</h3><ErrorBox error={detail.error}/>{detail.data && <><CatalogCheckNotice device={detail.data}/><JsonView value={detail.data} label="Inventar, Capabilities, Metriken, Dienste, Software, Updates, Logs und Quellen (soweit geliefert)"/></>}<AdminControl auth={auth} path={tenantPath(tenantId, `/devices/${encodeURIComponent(asset)}/revocation`)} permission="devices:revoke" title="Geräteidentität widerrufen" warning="ACHTUNG: Widerruf unterbricht die Geräteverwaltung und sperrt neue Starts. Kein Entfernen aus einer Liste, kein Rollback. Wiederaufnahme erfordert einen gesonderten sicheren Enrollment-/Recoveryprozess." done={detail.reload}/></article>}
|
||||
{tenantId === recoveryTenant && asset === recoveryAsset && allowed(auth, 'inventory:read') &&
|
||||
<><SyncAlignmentReview key={auth.principal.id + '-alignment'} auth={auth}/><EchoProbeReview key={auth.principal.id + '-probe'} auth={auth}/><EchoCompletionReview key={auth.principal.id + '-completion'} auth={auth}/><RecoveryReview key={auth.principal.id} auth={auth}/></>}
|
||||
<><SystemNonstartReview key={auth.principal.id + '-system-nonstart-221'} auth={auth}/><SyncAlignmentReview key={auth.principal.id + '-alignment'} auth={auth}/><EchoProbeReview key={auth.principal.id + '-probe'} auth={auth}/><EchoCompletionReview key={auth.principal.id + '-completion'} auth={auth}/><RecoveryReview key={auth.principal.id} auth={auth}/></>}
|
||||
</section>;
|
||||
}
|
||||
const initialParameters: Record<Action, RecordValue> = {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { expect, it } from 'vitest';
|
||||
import { canonicalJson } from './api';
|
||||
import { sha256 } from './safety';
|
||||
import { nonstartReview } from './system-nonstart-review';
|
||||
it('binds the exact 221 witness and refuses job authority, altered history and extended receipts', async () => {
|
||||
const witness = { schema_version: 1, tenant_id: '11111111-1111-4111-8111-111111111111', asset_id: 'a176520e-8a91-4e93-a78b-8e7620f430e0', agent_id: '63ea15b2-0643-403d-b5b4-cba1288dbea3',
|
||||
enrollment_generation: 1, assignment_version: 1, connection_generation: 221, boot_id: 'a9ad0895-5a96-8f2c-8fb6-cfdc2d5225ea', agent_checkpoint: 10784, helper_checkpoint: 420,
|
||||
agent_last_decision: '0442c732-8226-4c25-9615-7f007e24b269', helper_last_decision: '193b951b-a3aa-46e2-9f48-1a57f315078e', verification_key_id: 'a'.repeat(64),
|
||||
nonstart: { helper_pid: 1304, read_share_error: 32, read_write_share_passed: true, helper_image_sha256: '0502d6c87bd74c99f1665f3cc4b9d74b8e31d0f829d2ce1a1597d72e9be1e726', system_script_source_sha256: 'a3563e1aa8327b2e7046c7cdfb4f45ac213fec6ff7d477820ea2676a266c1695' },
|
||||
counts: { agent_jobs: 4, agent_consumed: 3, agent_starts: 3, agent_outcomes: 3, helper_consumed: 1, helper_starts: 1, helper_outcomes: 1, system_intents: 1 } };
|
||||
const witness_sha256 = await sha256(new TextEncoder().encode(canonicalJson(witness)));
|
||||
const request_id = '78009224-dcb3-4877-a519-8bf3284d0572';
|
||||
const receipt = { domain: 'rmm.dev.windows-system-nonstart-221.v1', schema_version: 1, request_id, server_transport_generation:287, witness, witness_sha256, key_id: witness.verification_key_id,
|
||||
issued_at: '2026-11-16T12:00:00Z', valid_until: '2026-11-16T12:05:00Z', confirmed_by: 'simulated-testprincipal-a', approval_origin: 'dev_test_browser_simulation', testsimulation: true, ready: false, helper_ready: false, unlock: false };
|
||||
const view = { request_id, server_transport_generation:287, witness, witness_sha256, receipt };
|
||||
expect((await nonstartReview(view)).witness_sha256).toBe(witness_sha256);
|
||||
for (const changed of [{ ready: true }, { helper_ready: true }, { unlock: true }, { testsimulation: false }, { confirmed_by: 'Administrator' }, { valid_until: '2026-11-16T12:05:01Z' }, { witness: { ...witness, helper_checkpoint: 412 } }]) {
|
||||
await expect(nonstartReview({ ...view, receipt: { ...receipt, ...changed } })).rejects.toThrow();
|
||||
}
|
||||
await expect(nonstartReview({ ...view, witness: { ...witness, connection_generation: 205 } })).rejects.toThrow();
|
||||
await expect(nonstartReview({ ...view, witness: { ...witness, counts: { ...witness.counts, helper_consumed: 2 } } })).rejects.toThrow();
|
||||
});
|
||||
@@ -0,0 +1,80 @@
|
||||
import React, { useState } from 'react';
|
||||
import { canonicalJson, pretty, record, RecordValue, request, Session, tenantPath } from './api';
|
||||
import { allowed, sha256 } from './safety';
|
||||
const tenant = '11111111-1111-4111-8111-111111111111';
|
||||
const asset = 'a176520e-8a91-4e93-a78b-8e7620f430e0';
|
||||
const agent = '63ea15b2-0643-403d-b5b4-cba1288dbea3';
|
||||
interface Review { request_id: string; witness: RecordValue; witness_sha256: string; server_transport_generation:number; receipt: RecordValue | null }
|
||||
export async function nonstartReview(value: unknown): Promise<Review> {
|
||||
const r = record(value), w = record(r.witness);
|
||||
if (typeof r.request_id !== 'string' || typeof r.witness_sha256 !== 'string' || !Number.isSafeInteger(r.server_transport_generation) || Number(r.server_transport_generation)<221 ||
|
||||
w.schema_version !== 1 || w.tenant_id !== tenant || w.asset_id !== asset || w.agent_id !== agent ||
|
||||
canonicalJson(w.counts) !== canonicalJson({ agent_jobs: 4, agent_consumed: 3, agent_starts: 3, agent_outcomes: 3, helper_consumed: 1, helper_starts: 1, helper_outcomes: 1, system_intents: 1 }) ||
|
||||
w.connection_generation !== 221 || w.enrollment_generation !== 1 || w.assignment_version !== 1 ||
|
||||
w.boot_id !== 'a9ad0895-5a96-8f2c-8fb6-cfdc2d5225ea' || w.agent_checkpoint !== 10784 ||
|
||||
typeof w.helper_checkpoint !== 'number' || w.helper_checkpoint < 413 ||
|
||||
w.agent_last_decision !== '0442c732-8226-4c25-9615-7f007e24b269' ||
|
||||
w.helper_last_decision !== '193b951b-a3aa-46e2-9f48-1a57f315078e' ||
|
||||
record(w.nonstart).helper_pid !== 1304 || record(w.nonstart).read_share_error !== 32 || record(w.nonstart).read_write_share_passed !== true ||
|
||||
record(w.nonstart).helper_image_sha256 !== '0502d6c87bd74c99f1665f3cc4b9d74b8e31d0f829d2ce1a1597d72e9be1e726' ||
|
||||
record(w.nonstart).system_script_source_sha256 !== 'a3563e1aa8327b2e7046c7cdfb4f45ac213fec6ff7d477820ea2676a266c1695' ||
|
||||
await sha256(new TextEncoder().encode(canonicalJson(w))) !== r.witness_sha256 ||
|
||||
!(r.receipt === null || (typeof r.receipt === 'object' && !Array.isArray(r.receipt)))) {
|
||||
throw new Error('Der administrative Zeuge passt nicht zum ausdrücklich freigegebenen Fall 221.');
|
||||
}
|
||||
if (r.receipt !== null) {
|
||||
const receipt = record(r.receipt);
|
||||
const issued = typeof receipt.issued_at === 'string' ? Date.parse(receipt.issued_at) : NaN;
|
||||
const until = typeof receipt.valid_until === 'string' ? Date.parse(receipt.valid_until) : NaN;
|
||||
if (receipt.domain !== 'rmm.dev.windows-system-nonstart-221.v1' || receipt.schema_version !== 1 ||
|
||||
receipt.request_id !== r.request_id || receipt.witness_sha256 !== r.witness_sha256 || receipt.server_transport_generation!==r.server_transport_generation ||
|
||||
canonicalJson(receipt.witness) !== canonicalJson(w) || receipt.key_id !== w.verification_key_id ||
|
||||
receipt.confirmed_by !== 'simulated-testprincipal-a' || receipt.approval_origin !== 'dev_test_browser_simulation' ||
|
||||
receipt.testsimulation !== true || receipt.ready !== false || receipt.helper_ready !== false || receipt.unlock !== false ||
|
||||
!Number.isFinite(issued) || !Number.isFinite(until) || until <= issued || until - issued > 300000) {
|
||||
throw new Error('Die administrative Quittung hat eine unzulässige Bindung oder behauptet Bereitschaft.');
|
||||
}
|
||||
}
|
||||
return r as unknown as Review;
|
||||
}
|
||||
export function SystemNonstartReview({ auth }: { auth: Session }) {
|
||||
const [review, setReview] = useState<Review | null>(null), [checked, setChecked] = useState(false);
|
||||
const [input, setInput] = useState(''), [busy, setBusy] = useState(false), [error, setError] = useState('');
|
||||
const eligible = auth.principal.simulated && auth.principal.id === 'simulated-testprincipal-a' && !!auth.csrf_token && allowed(auth, 'plans:approve');
|
||||
const path = tenantPath(tenant, '/windows-system-nonstart-221');
|
||||
async function load(submit: boolean) {
|
||||
setBusy(true); setChecked(false); setError(''); setReview(null);
|
||||
try {
|
||||
const result = await request(path, submit ? { csrf: auth.csrf_token, body: JSON.parse(input) as RecordValue } : {});
|
||||
if (record(result).request_id === null) throw new Error('Noch kein unabhängig erfasster Zeuge eingereicht.');
|
||||
setReview(await nonstartReview(result));
|
||||
} catch (e) { setError(String(e)); } finally { setBusy(false); }
|
||||
}
|
||||
async function confirm() {
|
||||
if (!eligible || !checked || !review || busy) return;
|
||||
setBusy(true); setChecked(false); setError('');
|
||||
try { setReview(await nonstartReview(await request(path + '/' + encodeURIComponent(review.request_id) + '/confirm', {
|
||||
csrf: auth.csrf_token, body: { reviewed: true, witness_sha256: review.witness_sha256 } })));
|
||||
} catch (e) { setReview(null); setError(String(e)); } finally { setBusy(false); }
|
||||
}
|
||||
return <section aria-label="Administrativer SYSTEM-Nichtstartabschluss 221">
|
||||
<h3>Administrativer SYSTEM-Nichtstartabschluss 221</h3>
|
||||
<p>Dieser ausdrücklich freigegebene Eingriff betrifft nur SYSTEM-Job 94047873…, Versuch f071e6d6…, Grant 97e705b8… und Kontrollspalt 221. Beide ursprünglichen Unknown-Outcomes, Starts, Intent, Originalsignaturen und Journalidentitäten bleiben erhalten. Ein zusätzlicher geprüfter Nichtstartbeleg darf ausschließlich fehlgeschlagen ableiten, niemals Erfolg. Er genehmigt keinen Auftrag und keinen Wiederholungsversuch. Beide Rollen müssen danach einen neuen regulären signierten Abgleich bestehen.</p>
|
||||
<label>Unabhängiger nativer Zeuge (JSON)<textarea aria-label="Nativer Nichtstartzeuge 221" value={input} disabled={busy} onChange={e => setInput(e.target.value)}/></label>
|
||||
<button disabled={busy || !input || !auth.csrf_token} onClick={() => void load(true)}>Zeugen einreichen und Originale serverseitig prüfen</button>{' '}
|
||||
<button disabled={busy} onClick={() => void load(false)}>Gespeicherten administrativen Fall prüfen</button>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
{review && <>
|
||||
<p>Historischer Kontrollspalt 221 · aktueller Servertransport {review.server_transport_generation} · Agentcheckpoint 10784 · tatsächlicher Helpercheckpoint {String(review.witness.helper_checkpoint)} · vier feste Jobs · ursprüngliches Unknown bleibt erhalten · nur abgeleiteter Nichtstart/failed · keine neue Startfreigabe</p>
|
||||
<p>Geprüfter Zeugenhash: <code>{review.witness_sha256}</code></p>
|
||||
<details><summary>Vollständige Originalbelege und Dateibindungen</summary><pre aria-label="Geprüfter SYSTEM-Nichtstartzeuge">{pretty(review)}</pre></details>
|
||||
{review.receipt && <p>Letzte Quittung gültig bis {String(review.receipt.valid_until)}. Ein erneuter Klick erzeugt ausschließlich eine neue befristete administrative Quittung für denselben unveränderten Zeugen.</p>}
|
||||
{eligible && <>
|
||||
<label><input type="checkbox" checked={checked} disabled={busy} onChange={e => setChecked(e.target.checked)}/>
|
||||
Ich habe genau den Fall 221, die erhaltenen Originalsignaturen, Dateibindungen und Nichtstartbeweiskette einschließlich Originalhelper 1304 und Sharingfehler 32 geprüft. Ich bestätige ausschließlich den zusätzlichen fehlgeschlagenen Nichtstartabschluss für Job 94047873/Grant 97e705b8 und Kontrollspalt 221, ohne Erfolg, Bereitschaft oder Jobfreigabe.</label>
|
||||
<button disabled={busy || !checked} onClick={() => void confirm()}>SIMULIERT: Exakten SYSTEM-Nichtstart 221 bestätigen</button>
|
||||
</>}
|
||||
{review.receipt && eligible && <a href={path + '/' + encodeURIComponent(review.request_id) + '/receipt'} download="windows-system-nonstart-221.json">Signierte administrative Quittung herunterladen</a>}
|
||||
</>}
|
||||
</section>;
|
||||
}
|
||||
Reference in New Issue
Block a user