Skip to content

Comments

Record audit entry when API tokens are auto-revoked#2759

Merged
migmartri merged 1 commit intochainloop-dev:mainfrom
migmartri:migmartri/token-revoke-audit
Feb 19, 2026
Merged

Record audit entry when API tokens are auto-revoked#2759
migmartri merged 1 commit intochainloop-dev:mainfrom
migmartri:migmartri/token-revoke-audit

Conversation

@migmartri
Copy link
Member

@migmartri migmartri commented Feb 18, 2026

When the APITokenStaleRevoker background service auto-revokes inactive API tokens, no audit entry was recorded. The revoke flow already dispatches an APITokenRevoked audit event, but it was silently dropped because APITokenRevoked inherited RequiresActor() → true from APITokenBase, and the stale revoker runs without a user or API token in context.

This fix overrides RequiresActor() on APITokenRevoked to return false, following the existing pattern used by CASBackendStatusChanged for system-generated events. Manual revocations continue to record the user actor, while auto-revocations now record the system actor (system@chainloop.dev).

Closes #2758

Allow APITokenRevoked audit events to be recorded when tokens are automatically revoked due to inactivity. Override RequiresActor() to return false on APITokenRevoked, following the pattern used by CASBackendStatusChanged. This enables the audit trail to capture auto-revocations with the system actor (system@chainloop.dev) rather than silently dropping the event.

Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
@migmartri migmartri merged commit 303b2c7 into chainloop-dev:main Feb 19, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit audit entry when API tokens are auto-revoked due to inactivity

2 participants