Expand description
WASM-Sandbox Crate Integration (Task 10)
This module provides integration with the wasm-sandbox crate for running
untrusted WASM plugins in a secure sandbox with:
- Memory isolation
- CPU time limits (fuel)
- Syscall filtering
- Capability-based access control
§Architecture
┌─────────────────────────────────────────────────────────────────┐
│ SochDB Kernel │
│ ┌───────────────────────────────────────────────────────────┐ │
│ │ WasmSandboxRuntime │ │
│ │ ┌─────────────────────────────────────────────────────┐ │ │
│ │ │ Sandbox Manager │ │ │
│ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ │
│ │ │ │Plugin 1 │ │Plugin 2 │ │Plugin N │ │ │ │
│ │ │ │ Sandbox │ │ Sandbox │ │ Sandbox │ │ │ │
│ │ │ └────┬────┘ └────┬────┘ └────┬────┘ │ │ │
│ │ │ │ │ │ │ │ │
│ │ │ ▼ ▼ ▼ │ │ │
│ │ │ ┌─────────────────────────────────────────────┐ │ │ │
│ │ │ │ Host Function Bridge │ │ │ │
│ │ │ │ soch_read │ soch_write │ vector_search │ │ │ │
│ │ │ └─────────────────────────────────────────────┘ │ │ │
│ │ └─────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘§Security Model
Each sandbox has:
- Isolated linear memory (no shared memory between plugins)
- Fuel-based execution limits (prevents infinite loops)
- Capability tokens (explicit permissions for each host function)
- Audit logging of all host calls
Structs§
- Default
Host Context Provider - Default host context provider for testing
- Plugin
Info - Information about a loaded plugin
- Plugin
Sandbox - An isolated sandbox for a single plugin
- Sandbox
Config - Configuration for the WASM sandbox runtime
- Sandbox
Runtime Stats - Global runtime statistics
- Sandbox
Stats - Statistics for a sandbox
- Wasm
Sandbox Runtime - WASM sandbox runtime manager
Enums§
- Sandbox
Error - Sandbox-specific errors
- Sandbox
State - Sandbox state
- Sandbox
Value - Value that can be passed to/from sandbox
Traits§
- Host
Context Provider - Provider for host context (dependency injection)