Skip to content

feat(audit): add audit logging for box operations#403

Merged
DorianZheng merged 1 commit into
mainfrom
feat/audit
Mar 23, 2026
Merged

feat(audit): add audit logging for box operations#403
DorianZheng merged 1 commit into
mainfrom
feat/audit

Conversation

@DorianZheng

Copy link
Copy Markdown
Member

Summary

  • Add bounded ring buffer audit log recording lifecycle, command, and file transfer events
  • New boxlite/src/audit/ module with AuditRecorder and AuditEvent types
  • LiteBox::audit_log() public API
  • Events recorded on: start(), exec(), stop(), copy_into(), copy_out()
  • Thread-safe, zero-copy recording
  • Python SDK: audit_log() binding

Test plan

  • 7 unit tests (recorder: capacity, thread safety, serde, events_since)
  • 1 integration test (default audit log is empty)
  • 1 VM integration test (start+exec+stop events) — #[ignore], needs runtime
  • 596 existing tests still pass

RocksDB-style EventListener for box operations. All callbacks default
to no-op — users implement only the events they care about.

- EventListener trait: on_box_created/started/stopped/removed,
  on_exec_started/completed, on_file_copied_in/out
- AuditEventListener: built-in impl that records events in ring buffer
- Register at runtime level via BoxliteOptions::event_listeners
- Users own and query their listener directly (no per-box audit_log API)
- Zero overhead when no listeners attached
- 4 unit tests + 3 integration tests
@DorianZheng DorianZheng merged commit c96311c into main Mar 23, 2026
20 checks passed
@DorianZheng DorianZheng deleted the feat/audit branch March 23, 2026 09:35
lilongen pushed a commit to lilongen/boxlite that referenced this pull request Mar 27, 2026
… mapping

Bridge the Rust EventListener trait (boxlite-ai#403) to Python via PyO3, enabling
push-based lifecycle callbacks (on_box_started, on_exec_completed, etc.).
Replace generic PyRuntimeError with 15 typed exception classes inheriting
from BoxliteError, using exhaustive match for compile-time completeness.

Key changes:
- PyEventListener bridge with duck-typing (missing methods silently skipped)
- map_boxlite_err() maps all 18 BoxliteError variants to typed Python exceptions
- event_listeners parameter on BoxliteOptions, propagated through RuntimeImpl
- 165 Python tests covering exception hierarchy, isolation, and exports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lilongen pushed a commit to lilongen/boxlite that referenced this pull request Apr 2, 2026
… mapping

Bridge the Rust EventListener trait (boxlite-ai#403) to Python via PyO3, enabling
push-based lifecycle callbacks (on_box_started, on_exec_completed, etc.).
Replace generic PyRuntimeError with 15 typed exception classes inheriting
from BoxliteError, using exhaustive match for compile-time completeness.

Key changes:
- PyEventListener bridge with duck-typing (missing methods silently skipped)
- map_boxlite_err() maps all 18 BoxliteError variants to typed Python exceptions
- event_listeners parameter on BoxliteOptions, propagated through RuntimeImpl
- 165 Python tests covering exception hierarchy, isolation, and exports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lilongen pushed a commit to lilongen/boxlite that referenced this pull request Apr 21, 2026
… mapping

Bridge the Rust EventListener trait (boxlite-ai#403) to Python via PyO3, enabling
push-based lifecycle callbacks (on_box_started, on_exec_completed, etc.).
Replace generic PyRuntimeError with 15 typed exception classes inheriting
from BoxliteError, using exhaustive match for compile-time completeness.

Key changes:
- PyEventListener bridge with duck-typing (missing methods silently skipped)
- map_boxlite_err() maps all 18 BoxliteError variants to typed Python exceptions
- event_listeners parameter on BoxliteOptions, propagated through RuntimeImpl
- 165 Python tests covering exception hierarchy, isolation, and exports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant