fix(audit): attach jti to AuthTokenRevoked event metadata#25
Merged
Conversation
paseto.rs and jwt.rs both emit AuthTokenRevoked when a revoked token is
presented, but only set source.subject — the JTI of the revoked token,
which is the natural correlation key for SIEM rules, retroactive
search ("show every request that presented this token"), and
revocation-list audit, was in scope at the emission site but dropped
before the event was constructed.
log_auth(kind, severity, source) is the convenience wrapper that
doesn't accept metadata. Switch the two emission sites to build the
AuditEvent explicitly with AuditEvent::new(...).with_source(source)
.with_metadata(json!({"jti": jti})) and call logger.log(event)
directly. No API widening; matches the pattern already used by
AuditAccountNotification.
Closes #18.
AuthTokenInvalid enrichment (kid/iss/sub from the decode error) is a
separate, more invasive change tracked under #16 / future work.
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
The PASETO and JWT auth middlewares emit
AuthTokenRevokedwhen a revoked token is presented, but only attachsource.subject. The JTI of the revoked token — the natural correlation key for SIEM rules, retroactive search ("show every request that presented this token"), and revocation-list audit — was in scope at the emission site but dropped before the event was constructed.The convenience wrapper
logger.log_auth(kind, severity, source)doesn't accept metadata. Switch the two emission sites to build theAuditEventexplicitly withwith_source(source).with_metadata(json!({"jti": jti}))and calllogger.log(event)directly. No API widening — matches the patternAuditAccountNotificationalready uses (accounts/mod.rs:744).Closes #18.
Out of scope
The issue noted that
AuthTokenInvalidhas similar enrichment value — when validation fails,kid/iss/ sometimessubare available in the decode error but none ship. That's a more invasive change (the decode-error type isn't currently exposed at the middleware emission point) and is tracked under #16 / future follow-up.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 passmetadata.jtipopulated onauth.token.revokedevents after upgrade.