Commit 336b395
audit: canonical event taxonomy in cambios-abi (class + generated doc)
What
- New cambios-abi/src/audit.rs: the audit_taxonomy! macro emits, from one
table, AuditEventKind (the 22 wire discriminants), its
name()/class()/args_doc()/from_u8() methods, and the TAXONOMY const slice.
Match arms and slice are generated from the same input, so they cannot drift.
- Canonical domain.action naming vocabulary (cap.granted, enforce.syscall_denied,
meta.audit_dropped, ...) and a coarse AuditClass (security / dataflow /
lifecycle / context / anomaly / meta) carried in flags-byte bits 1..=3.
- RawAuditEvent::build stamps the class centrally from kind.class(); the emit
call site never chooses it. src/audit/mod.rs re-exports AuditEventKind +
FLAG_SAMPLED from the ABI crate and drops its local copies. Builders unchanged.
- tools/gen-audit-taxonomy renders docs/generated/audit-taxonomy.md from the
TAXONOMY slice. make audit-taxonomy regenerates; make check-audit-taxonomy
verifies in-sync (generate-and-verify, same shape as check-adrs -> INDEX.md).
Why
- The ADR-007 "what gets logged" table had frozen at 15 events while the enum
grew to 22 - the recurring "stale ADR" shape: enumerable data duplicated into
a durable doc. Source of truth now lives once in code; the doc is generated.
- Class set at the definition site (not the call site) makes the 2026-05-10
backpressure-mislabel class - an operational drop emitted as cap.denied -
structurally hard: a meta.* event cannot be confused with a security event.
- domain.action gives legible logs + a stable grep surface across arches; the
domain prefix answers "which layer denied" (cap.denied vs
enforce.syscall_denied; enforce.policy_query is a consultation, not a denial).
Wire stability
- Discriminants are append-only / never reused. AUDIT_TAXONOMY_VERSION = 1 bumps
on any add or rename. flags byte: bit 0 sampled, bits 1-3 class, 4-7 reserved
(no growth; still 64 bytes / one cache line).
Out of scope (follow-ups)
- user/audit-tail adopting the shared vocabulary + rendering domain.action.
- Surfacing AUDIT_TAXONOMY_VERSION via SYS_AUDIT_INFO.
- ADR-007 amendment: replace the frozen event table with categories + rationale
+ a pointer to the generated doc, prior table -> Divergence appendix. Needs
sign-off on the diff first (ADR-edit gate).
- check-audit-taxonomy is a local make-target lint, not ubuntu-CI-gated (the host
tool targets aarch64-apple-darwin like sign-elf); matches the precedent that
generated-doc staleness is not CI-gated (INDEX.md is not either).
Verification
- make check-all clean (x86_64 + aarch64 + riscv64).
- 907 host lib tests pass; 8 new abi taxonomy tests pass (12 total in cambios-abi).
- make check-audit-taxonomy: in sync.
- check-assumptions / check-deferrals / check-unsafe-coverage: 0 new.
- check-index-isolation: pass (STATUS.md +1 line).
Staged files:
- CLAUDE.md
- Cargo.toml
- Makefile
- STATUS.md
- cambios-abi/src/audit.rs
- cambios-abi/src/lib.rs
- docs/generated/audit-taxonomy.md
- src/audit/mod.rs
- tools/gen-audit-taxonomy/.cargo/config.toml
- tools/gen-audit-taxonomy/Cargo.lock
- tools/gen-audit-taxonomy/Cargo.toml
- tools/gen-audit-taxonomy/src/main.rs
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent e9d5651 commit 336b395
12 files changed
Lines changed: 661 additions & 96 deletions
File tree
- cambios-abi/src
- docs/generated
- src/audit
- tools/gen-audit-taxonomy
- .cargo
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| |||
1273 | 1273 | | |
1274 | 1274 | | |
1275 | 1275 | | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
1276 | 1299 | | |
1277 | 1300 | | |
1278 | 1301 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
0 commit comments