fix(audit): stop emitting auth.login.failed for unauthenticated requests#14
Merged
Conversation
The PASETO and JWT middleware emitted AuditEventKind::AuthLoginFailed whenever a request reached a protected route without a valid token, conflating real credential-submission failures with routine unauthenticated probes (health checks, scanners, etc.). Downstream operators behind ALB health checks reported thousands of false-positive auth.login.failed events per day, drowning out real signal. Introduce two new variants — AuthTokenMissing (Informational) and AuthTokenInvalid (Warning) — and repoint the four middleware emission sites to use them. AuthLoginFailed is now reserved for application credential-submission failures (e.g. /auth/login handlers), as documented in its doc comment. Storage backends (Postgres, ClickHouse, Turso, SurrealDB) gain round-trip parsing for the new event-kind strings. Closes #13
This was referenced May 28, 2026
Closed
This was referenced May 28, 2026
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
AuthTokenMissing(Informational) andAuthTokenInvalid(Warning) variants toAuditEventKind.paseto.rsandjwt.rsto use them instead ofAuthLoginFailed.AuthLoginFailedfor application credential-submission failures (e.g./auth/loginhandlers); doc comment updated.Closes #13.
Why
The middleware fired
auth.login.failedfor every request that arrived without a valid bearer token — including unauthenticated health checks. A downstream report showed ~5,758 false-positiveauth.login.failedevents per day from ALB health checks (vs. 4 real logins), drowning out real signal for SIEM rules and security monitoring.The new variants let operators filter health-check-shaped noise (
auth.token.missing) separately from credential failures (auth.login.failed) and presented-but-bad tokens (auth.token.invalid).Breaking change
Removes
auth.login.failedfrom the middleware's emission set. Downstream SIEM rules keyed onauth.login.failedfrom acton-service alone will go quiet for the unauthenticated-request case (the goal). App-level login handlers continue to emit it correctly. Worth a minor-version bump (0.27.0) given the observable behavior change.Out of scope
AuditSourceis populated before auth runs (soip/request_idare no longer blank in token-failure events). Bigger refactor; deferred — see issue auth middleware emits auth.login.failed on every unauthenticated request #13 item (3).audit_token_failures: boolto silence token-missing entirely. Easy follow-up if the newInformationallevel isn't filtered enough.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