Separate script publishing, job assignment and interactive approval in the WebUI
This commit is contained in:
@@ -9,7 +9,7 @@ it('renders hostile output as inert text, reports real status and preserves exac
|
||||
const hostile = '<script>fetch("/approve")</script>\r\n\x1b[2J\u202eapprove', raw = Array.from(new TextEncoder().encode(hostile));
|
||||
const job = { state: 'unknown', attempt_id: 'fixed-attempt', revision: 4, cancel_requested: true, result: { stdout: raw, stderr: [], exit_code: null, error_code: 'TIMEOUT', output_truncated: true, reboot_required: false } };
|
||||
const before = JSON.stringify(job), html = renderToStaticMarkup(<ConsoleOutput job={job}/>);
|
||||
for (const expected of ['unknown', 'fixed-attempt', 'TIMEOUT', 'unknown / nicht gemeldet', 'nur ein Ausschnitt', 'keinen Live-Ausgabestream', 'Abbruch angefordert', 'neuen genehmigten Plan', '<script>', '\\u000d', '\\u001b', '\\u202e', JSON.stringify(raw)]) expect(html).toContain(expected);
|
||||
for (const expected of ['unknown', 'fixed-attempt', 'TIMEOUT', 'Nicht gemeldet', 'nur ein Ausschnitt', 'gespeicherte Ausgabe', 'Abbruch angefordert', 'neuen genehmigten Plan', '<script>', '\\u000d', '\\u001b', '\\u202e', JSON.stringify(raw)]) expect(html).toContain(expected);
|
||||
expect(html).not.toMatch(/<(script|img|iframe|form|input)\b/i);
|
||||
expect(html).not.toContain('onclick='); expect(fetch).not.toHaveBeenCalled(); expect(JSON.stringify(job)).toBe(before);
|
||||
} finally { vi.unstubAllGlobals(); }
|
||||
@@ -34,8 +34,8 @@ it('shows unknown restart state for an incomplete Windows Update summary', () =>
|
||||
}};
|
||||
return renderToStaticMarkup(<ConsoleOutput job={{ result }}/>);
|
||||
}
|
||||
expect(rendered(windowsUpdateScriptHash)).toContain('Neustartbedarf: unknown');
|
||||
expect(rendered('ordinary script')).toContain('Neustartbedarf: false');
|
||||
expect(rendered(windowsUpdateScriptHash)).toContain('Neustartbedarf unbekannt');
|
||||
expect(rendered('ordinary script')).not.toContain('Neustartbedarf unbekannt');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user