feat(dashboard): AUD1T — privileged-actions audit trail as a LOGS sub-tab

Adds an AUDIT sub-tab to /logs.html (alongside BUILD / AGENT / SYSTEM),
consuming GET /api/audit-log ({ entries, total }). A read-only filterable
table: when / agent / action / target / outcome / detail, newest-first,
with a 'latest 500 of N' header from total and a client-side substring
filter. Outcome badges colour ok green / err red, with an err whose detail
starts 'denied:' rendered amber + labelled 'denied' (capability refusal
reads distinct from an execution failure). Lazy-fetched on tab show (like
SYSTEM); a 30s ticker keeps the relative timestamps honest.

The audit_log store + endpoint landed in the prior audit-log backend work;
this is the operator-visible surface for it. Resolves #1647.
This commit is contained in:
iris 2026-06-13 14:08:27 +02:00
commit 8b991b2cc5
4 changed files with 212 additions and 4 deletions

View file

@ -175,3 +175,66 @@ body.logs-shell {
.build-logs-live-badge.badge-running { animation: live-pulse 1.4s ease-in-out infinite; }
.build-logs-runtime { font-size: 0.85em; color: var(--muted); }
/* ─── AUDIT tab — privileged-actions audit trail table ──────────────── */
.audit-filter {
flex: 1 1 18em;
min-width: 0;
padding: 0.35em 0.6em;
background: var(--bg-elev);
color: var(--fg);
border: 1px solid var(--border);
border-radius: 4px;
font-family: inherit;
font-size: 0.9em;
}
.audit-table-wrap { overflow-x: auto; }
.audit-table {
width: 100%;
border-collapse: collapse;
font-size: 0.88em;
}
.audit-table th,
.audit-table td {
text-align: left;
padding: 0.4em 0.7em;
border-bottom: 1px solid var(--border);
vertical-align: top;
}
.audit-table th {
color: var(--muted);
font-weight: bold;
text-transform: uppercase;
letter-spacing: 0.06em;
font-size: 0.82em;
white-space: nowrap;
}
.audit-table tbody tr:hover {
background: color-mix(in srgb, var(--bg-elev) 45%, transparent);
}
.audit-when, .audit-when-th { white-space: nowrap; }
.audit-agent { font-weight: bold; white-space: nowrap; }
.audit-action { font-family: monospace; white-space: nowrap; }
.audit-target { white-space: nowrap; }
.audit-detail { word-break: break-word; }
.audit-outcome-th, .audit-outcome-td { white-space: nowrap; }
.audit-outcome {
display: inline-block;
padding: 0 0.5em;
border-radius: 999px;
font-size: 0.82em;
font-weight: bold;
white-space: nowrap;
}
.audit-outcome-ok {
background: color-mix(in srgb, var(--green) 22%, transparent);
color: var(--green);
}
.audit-outcome-err {
background: color-mix(in srgb, var(--red) 22%, transparent);
color: var(--red);
}
.audit-outcome-denied {
background: color-mix(in srgb, var(--yellow) 22%, transparent);
color: var(--yellow);
}