pub struct AuditEntry {
pub event_type: AuditEventType,
pub secret_type: SecretType,
pub subject: Option<String>,
pub operation: String,
pub success: bool,
pub error_message: Option<String>,
pub context: Option<String>,
pub chain_hash: Option<String>,
}Expand description
Audit log entry
§Size Bounds
To prevent memory exhaustion and ensure predictable performance, each field is bounded in size:
subject: Max 256 bytes (seebounds::MAX_SUBJECT_LEN)operation: Max 50 bytes (seebounds::MAX_OPERATION_LEN)error_message: Max 1 KB (seebounds::MAX_ERROR_MESSAGE_LEN)context: Max 2 KB (seebounds::MAX_CONTEXT_LEN)- Total per entry: ~4 KB
§Thread Safety
This struct is immutable once created and Send + Sync, making it safe to
pass between threads. Audit loggers that implement AuditLogger trait are
responsible for thread-safe storage.
Fields§
§event_type: AuditEventTypeEvent type (jwt_validation, oauth_callback, etc.)
secret_type: SecretTypeType of secret accessed (jwt_token, session_token, etc.)
subject: Option<String>Subject (user ID, service account, etc.) - None for anonymous
Max 256 bytes per bounds::MAX_SUBJECT_LEN
operation: StringOperation performed (validate, create, revoke, etc.)
Max 50 bytes per bounds::MAX_OPERATION_LEN
success: boolWhether the operation succeeded
error_message: Option<String>Error message if operation failed (user-safe message)
Max 1 KB per bounds::MAX_ERROR_MESSAGE_LEN
context: Option<String>Additional context
Max 2 KB per bounds::MAX_CONTEXT_LEN
chain_hash: Option<String>HMAC-SHA256 chain hash for tamper detection (64 hex chars).
Each entry’s hash depends on all previous entries, making retroactive
tampering detectable. None when tamper-evident logging is disabled.
Verify with crate::audit::chain::verify_chain.
Trait Implementations§
Source§impl Clone for AuditEntry
impl Clone for AuditEntry
Source§fn clone(&self) -> AuditEntry
fn clone(&self) -> AuditEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuditEntry
impl Debug for AuditEntry
Source§impl<'de> Deserialize<'de> for AuditEntry
impl<'de> Deserialize<'de> for AuditEntry
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AuditEntry
impl RefUnwindSafe for AuditEntry
impl Send for AuditEntry
impl Sync for AuditEntry
impl Unpin for AuditEntry
impl UnsafeUnpin for AuditEntry
impl UnwindSafe for AuditEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more