Recheck the submitting principal and protect stored log output
This commit is contained in:
@@ -66,3 +66,11 @@ it('selects the native PowerShell text view only from matching result evidence',
|
||||
const other = renderToStaticMarkup(<ConsoleOutput job={{result:{...result,evidence:{interpreter:'posix_sh',output_encoding:'raw_native_bytes'}}}}/>);
|
||||
expect(other).not.toContain('bösartig');
|
||||
});
|
||||
|
||||
it('shows the stored exit code and permission message for a restricted log result', () => {
|
||||
const html = renderToStaticMarkup(<ConsoleOutput job={{state:'succeeded', result:{output_restricted:true, exit_code:0}}}/>);
|
||||
expect(html).toContain('Exitcode 0');
|
||||
expect(html).toContain('Leseberechtigung');
|
||||
expect(html).not.toContain('herunterladen');
|
||||
expect(html).not.toContain('Noch kein gespeichertes Ergebnis');
|
||||
});
|
||||
|
||||
@@ -77,6 +77,10 @@ function Result({ value }: { value: unknown }) {
|
||||
const windowsUpdate = evidence.script_sha256 === windowsUpdateScriptHash;
|
||||
const reboot = windowsUpdate && Object.hasOwn(evidence, 'windows_update_reboot_required') ? evidence.windows_update_reboot_required : result.reboot_required;
|
||||
const exit = typeof result.exit_code === 'number' && Number.isInteger(result.exit_code) ? String(result.exit_code) : 'Nicht gemeldet';
|
||||
if (result.output_restricted === true) return <>
|
||||
<p><strong>Exitcode {exit}</strong></p>
|
||||
<p>Für diese Protokollausgabe fehlt dir die Leseberechtigung.</p>
|
||||
</>;
|
||||
return <>
|
||||
<p><strong>Exitcode {exit}</strong>{typeof result.error_code === 'string' && result.error_code && ' · Fehlercode '+result.error_code}</p>
|
||||
{reboot === true && <p className="warning">Ein Neustart ist erforderlich.</p>}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ApiError, record, request, tenant, tenantPath, type Tenant, type Sessio
|
||||
const scopeLabels = {
|
||||
'inventory:read': 'Inventar lesen',
|
||||
'logs:read': 'Gespeicherte Protokolle lesen',
|
||||
'logs:read_sensitive': 'Sensible Protokolle lesen',
|
||||
'operations:read': 'Aufträge und Ergebnisse lesen',
|
||||
'operations:plan': 'Aufträge planen',
|
||||
'operations:submit': 'Aufträge zur Genehmigung einreichen',
|
||||
|
||||
Reference in New Issue
Block a user