-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudit.html
More file actions
76 lines (74 loc) · 3.43 KB
/
audit.html
File metadata and controls
76 lines (74 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{% extends "base.html" %}
{% block content %}
<div class="audit-page">
<div class="audit-controls">
<h2>Broker Audit Trail</h2>
<p class="description">Hash-chained, immutable record of every credential event. Each entry links to the previous via SHA-256 hash.</p>
<div class="control-group">
<button class="btn-secondary" hx-get="/api/audit/events?limit=100" hx-target="#audit-table-body" hx-swap="innerHTML" hx-indicator="#audit-loading">
Refresh Events
</button>
<select id="audit-filter-type" onchange="filterAudit()">
<option value="">All Event Types</option>
<option value="agent_registered">Agent Registered</option>
<option value="token_issued">Token Issued</option>
<option value="token_renewed">Token Renewed</option>
<option value="token_released">Token Released</option>
<option value="token_revoked">Token Revoked</option>
<option value="delegation_created">Delegation Created</option>
<option value="scope_violation">Scope Violation</option>
<option value="token_auth_failed">Auth Failed</option>
</select>
<span id="audit-loading" class="htmx-indicator">Loading...</span>
</div>
</div>
{% if error %}
<div class="error-banner">{{ error }}</div>
{% endif %}
<div class="audit-table-wrapper">
<table class="audit-table">
<thead>
<tr>
<th>ID</th>
<th>Timestamp</th>
<th>Event Type</th>
<th>Agent ID</th>
<th>Task</th>
<th>Outcome</th>
<th>Detail</th>
<th>Hash Chain</th>
</tr>
</thead>
<tbody id="audit-table-body">
{% for event in events %}
<tr class="audit-row outcome-{{ event.get('outcome', 'unknown') }}">
<td class="mono">{{ event.get('id', '') }}</td>
<td class="mono">{{ event.get('timestamp', '')[:19] }}</td>
<td>
<span class="event-type-badge type-{{ event.get('event_type', '') }}">
{{ event.get('event_type', '') }}
</span>
</td>
<td class="mono truncate" title="{{ event.get('agent_id', '') }}">
{{ event.get('agent_id', '')[-30:] }}
</td>
<td>{{ event.get('task_id', '') }}</td>
<td>
<span class="outcome-badge outcome-{{ event.get('outcome', '') }}">
{{ event.get('outcome', '') }}
</span>
</td>
<td class="detail-cell">{{ event.get('detail', '') }}</td>
<td class="mono truncate" title="hash: {{ event.get('hash', '') }} prev: {{ event.get('prev_hash', '') }}">
{{ event.get('hash', '')[:12] }}...
</td>
</tr>
{% endfor %}
{% if not events %}
<tr><td colspan="8" class="empty-state">No audit events. Run an encounter first.</td></tr>
{% endif %}
</tbody>
</table>
</div>
</div>
{% endblock %}