Add versioned script library, reconcile permit refusals and compact helper captures
This commit is contained in:
@@ -37,6 +37,20 @@ it('projects legacy/Linux root/Windows SYSTEM from the exact shared Rust golden
|
||||
}
|
||||
});
|
||||
|
||||
it('shows the immutable library revision and rejects a different catalog script hash', async () => {
|
||||
const parsed = record(plan('legacy_linux_agent').plan_payload);
|
||||
const job = (parsed.jobs as RecordValue[])[0]!;
|
||||
const ref = { revision_id: '27068008-ae22-4bde-8e54-d81624523a93', name: 'Agentversion', version: 3, script_sha256: job.script_sha256 };
|
||||
async function stored(hash: unknown) {
|
||||
const raw = new TextEncoder().encode(JSON.stringify({ ...parsed, script_revision: { ...ref, script_sha256: hash } }));
|
||||
return { plan_hash: await sha256(raw), plan_payload_bytes: Array.from(raw) };
|
||||
}
|
||||
const good = await stored(ref.script_sha256);
|
||||
await verifyPlanIntegrity(good); await verifyScriptPlan(good);
|
||||
expect(scriptPlanJobs(good)[0]?.revision).toEqual({ id: ref.revision_id, name: ref.name, version: 3 });
|
||||
await expect(verifyScriptPlan(await stored('f'.repeat(64)))).rejects.toThrow('Bibliotheksversion');
|
||||
});
|
||||
|
||||
it('rejects view, byte and fixed identity/budget/profile tampering before and after display', async () => {
|
||||
for (const alias of ['payload', 'plan_payload', 'jobs', 'resolved_targets']) {
|
||||
const p = plan('linux_root_full'); await verifyScriptPlan(p); p[alias] = [];
|
||||
|
||||
Reference in New Issue
Block a user