fix(audit): parse config.*, account.*, and lockout event strings back to typed variants#21
Merged
Merged
Conversation
… to typed variants All four storage backends (pg, clickhouse, turso, surrealdb) reconstruct AuditEventKind from a stored string via a match expression. Three whole event families that the framework actively emits had no parser arms and silently round-tripped as AuditEventKind::Custom on query: - config.loaded / config.drift_detected (audit/config_audit.rs — NIST CM-3) - account.* (accounts/mod.rs, gated on the `accounts` feature) - auth.account.locked / auth.account.unlocked (lockout/mod.rs, gated on the `login-lockout` feature) Add the missing arms to each backend, gated to match the variant cfgs in audit/event.rs. Extend the existing ClickHouse roundtrip coverage test to assert the new arms under their respective feature flags. Closes #15
3 tasks
rrrodzilla
added a commit
that referenced
this pull request
May 28, 2026
Reflects the audit-event work that landed in #14, #21, #22 and is queued in #23, #25: - audit/page.md: rewrite the "Auth Events (Automatic)" table to match the new emission set (AuthLoginSuccess at Notice; AuthTokenMissing / AuthTokenInvalid added; AuthTokenRevoked notes jti metadata; AuthPermissionDenied and HttpRequestDenied added); update the syslog and OTLP example severities to Notice; expand the "Event Kinds" reference table; add a migration callout for AuthLoginFailed. - cedar-auth/page.md: add "Audit Integration" section describing automatic AuthPermissionDenied emission on Decision::Deny. - rate-limiting/page.md: add "Audit Integration" section describing automatic HttpRequestDenied emission on RateLimitExceeded. - token-auth/page.md: add "Audit Emission" section covering the four middleware-emitted kinds, the jti correlation field, and the AuthLoginFailed migration. Refs #13 #15 #16 #18 #19
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
All four audit storage backends (
pg,clickhouse,turso,surrealdb) reconstructAuditEventKindfrom a stored string via amatch. Three whole event families that the framework actively emits had no parser arms and silently round-tripped asAuditEventKind::Custom(...):config.loaded/config.drift_detected— emitted byaudit/config_audit.rs(NIST CM-3)account.*(created/disabled/enabled/locked/unlocked/expired/deleted/updated) — emitted byaccounts/mod.rsunder theaccountsfeatureauth.account.locked/auth.account.unlocked— emitted bylockout/mod.rsunder thelogin-lockoutfeatureAdds the missing arms in each backend, gated to match the variant cfgs in
audit/event.rs. Extends the existing ClickHouse roundtrip coverage test to assert the new arms under their respective feature flags — that test fails by-design if any arm regresses to theCustomcatch-all (string would render ascustom.config.loadedinstead ofconfig.loaded).Closes #15.
Why
Rust consumers pattern-matching on
AuditEventKindwere silently seeingCustom("account.locked")instead ofAccountLocked. SIEM queries keyed on the stored string still worked; the bug was at the typed-deserialization boundary. This is the same shape as #14's bug but spread across three more event families that PR didn't touch.Out of scope
Customcatch-all that enabled this silent failure is tracked separately in audit: storage parser Custom fallthrough silently swallows framework-owned namespaces on version skew #20.Test plan
cargo clippy -p acton-service --all-targets --features full -- -D warnings— cleancargo clippy -p acton-service --all-targets --no-default-features --features "full,crypto-ring" -- -D warnings— cleancargo nextest run -p acton-service --features full— 520/520 pass (extended roundtrip test exercises the new arms)