TenantAtlas/resources/views/filament/system/pages/ops/view-run.blade.php
ahmido cd811cff4f Spec 120: harden secret redaction integrity (#146)
## Summary
- replace broad substring-based masking with a shared exact/path-based secret classifier and workspace-scoped fingerprint hashing
- persist protected snapshot metadata on `policy_versions` and keep secret-only changes visible in compare, drift, restore, review, verification, and ops surfaces
- add Spec 120 artifacts, audit documentation, and focused Pest regression coverage for snapshot, audit, verification, review-pack, and notification behavior

## Validation
- `vendor/bin/sail artisan test --compact tests/Feature/Intune/PolicySnapshotRedactionTest.php tests/Feature/Intune/PolicySnapshotFingerprintIsolationTest.php tests/Feature/ReviewPack/ReviewPackRedactionIntegrityTest.php tests/Feature/OpsUx/OperationRunNotificationRedactionTest.php tests/Feature/Verification/VerificationReportViewerDbOnlyTest.php`
- `vendor/bin/sail bin pint --dirty --format agent`

## Spec / checklist status
| Checklist | Total | Completed | Incomplete | Status |
|-----------|-------|-----------|------------|--------|
| requirements.md | 16 | 16 | 0 | ✓ PASS |

- `tasks.md`: T001-T032 complete
- `tasks.md`: T033 manual quickstart validation is still open and noted for follow-up

## Filament / platform notes
- Livewire v4 compliance is unchanged
- no panel provider changes; `bootstrap/providers.php` remains the registration location
- no new globally searchable resources were introduced, so global search requirements are unchanged
- no new destructive Filament actions were added
- no new Filament assets were added; no `filament:assets` deployment change is required

## Testing coverage touched
- snapshot persistence and fingerprint isolation
- compare/drift protected-change evidence
- audit, verification, review-pack, ops-failure, and notification sanitization
- viewer/read-only Filament presentation updates

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #146
2026-03-07 16:43:01 +00:00

143 lines
5.9 KiB
PHP

@php
/** @var \App\Models\OperationRun $run */
$run = $this->run;
$statusSpec = \App\Support\Badges\BadgeRenderer::spec(
\App\Support\Badges\BadgeDomain::OperationRunStatus,
(string) $run->status,
);
$outcomeSpec = (string) $run->status === 'completed'
? \App\Support\Badges\BadgeRenderer::spec(
\App\Support\Badges\BadgeDomain::OperationRunOutcome,
(string) $run->outcome,
)
: null;
$summaryCounts = is_array($run->summary_counts) ? $run->summary_counts : [];
$hasSummary = count($summaryCounts) > 0;
$integrityNote = \App\Support\RedactionIntegrity::noteForRun($run);
@endphp
<x-filament-panels::page>
<div class="space-y-6">
<x-filament::section>
<x-slot name="heading">
Run #{{ (int) $run->getKey() }}
</x-slot>
<x-slot name="description">
{{ \App\Support\OperationCatalog::label((string) $run->type) }}
</x-slot>
<x-slot name="afterHeader">
<div class="flex items-center gap-2">
<x-filament::badge
:color="$statusSpec->color"
:icon="$statusSpec->icon"
>
{{ $statusSpec->label }}
</x-filament::badge>
@if ($outcomeSpec)
<x-filament::badge
:color="$outcomeSpec->color"
:icon="$outcomeSpec->icon"
>
{{ $outcomeSpec->label }}
</x-filament::badge>
@endif
</div>
</x-slot>
<dl class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
<div>
<dt class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">Workspace</dt>
<dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
{{ $run->workspace?->name ?? 'Unknown workspace' }}
</dd>
</div>
<div>
<dt class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">Tenant</dt>
<dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
{{ $run->tenant?->name ?? 'Tenantless' }}
</dd>
</div>
<div>
<dt class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">Started</dt>
<dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
{{ $run->started_at?->toDayDateTimeString() ?? '—' }}
</dd>
</div>
<div>
<dt class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">Completed</dt>
<dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
{{ $run->completed_at?->toDayDateTimeString() ?? '—' }}
</dd>
</div>
<div>
<dt class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">Initiator</dt>
<dd class="mt-1 text-sm font-medium text-gray-950 dark:text-white">
{{ (string) ($run->initiator_name ?? '—') }}
</dd>
</div>
<div>
<dt class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">Runbooks</dt>
<dd class="mt-1 text-sm">
<x-filament::link href="{{ \App\Filament\System\Pages\Ops\Runbooks::getUrl(panel: 'system') }}">
Go to runbooks
</x-filament::link>
</dd>
</div>
</dl>
</x-filament::section>
@if ($integrityNote)
<x-filament::section>
<div class="rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100">
{{ $integrityNote }}
</div>
</x-filament::section>
@endif
@if ($hasSummary)
<x-filament::section>
<x-slot name="heading">
Summary counts
</x-slot>
<div class="grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4">
@foreach ($summaryCounts as $key => $value)
<div class="rounded-lg bg-gray-50 px-4 py-3 dark:bg-white/5">
<p class="text-xs font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400">
{{ \Illuminate\Support\Str::headline((string) $key) }}
</p>
<p class="mt-1 text-xl font-bold text-gray-950 dark:text-white">
{{ is_numeric($value) ? number_format((int) $value) : $value }}
</p>
</div>
@endforeach
</div>
</x-filament::section>
@endif
@if (! empty($run->failure_summary))
<x-filament::section>
<x-slot name="heading">
<div class="flex items-center gap-2 text-danger-600 dark:text-danger-400">
<x-heroicon-m-exclamation-circle class="h-5 w-5" />
Failures
</div>
</x-slot>
@include('filament.partials.json-viewer', ['value' => $run->failure_summary])
</x-filament::section>
@endif
</div>
</x-filament-panels::page>