audit
audit
¶
Audit logger — persist security events to SQLite with Merkle hash chain.
Classes¶
AuditLogger
¶
AuditLogger(db_path: Union[str, Path] = DEFAULT_CONFIG_DIR / 'audit.db', bus: Optional[EventBus] = None)
Append-only SQLite audit log for security events.
| PARAMETER | DESCRIPTION |
|---|---|
db_path
|
Path to the SQLite database file.
TYPE:
|
bus
|
Optional event bus — if provided, subscribes to security events
(
TYPE:
|
Source code in src/openjarvis/security/audit.py
Functions¶
log
¶
log(event: SecurityEvent) -> None
Insert a security event into the audit log with Merkle hash chain.
Source code in src/openjarvis/security/audit.py
query
¶
query(*, event_type: Optional[str] = None, since: Optional[float] = None, limit: int = 100) -> List[SecurityEvent]
Query logged security events with optional filters.
Source code in src/openjarvis/security/audit.py
tail_hash
¶
Return the hash of the last row in the chain, or empty string.
Source code in src/openjarvis/security/audit.py
verify_chain
¶
Verify the Merkle hash chain integrity.
| RETURNS | DESCRIPTION |
|---|---|
tuple
|
|
Source code in src/openjarvis/security/audit.py
count
¶
Return the total number of logged security events.