Expand description
Dual-context error handling for honeypot systems with type-enforced trust boundaries.
§Architecture
This module separates public-facing error messages from internal diagnostic data using distinct types that cannot be confused at compile time:
PublicContext: Contains data safe for external display (truthful or deceptive)InternalContext: Contains diagnostic data restricted to authenticated SOC accessDualContextError: Pairs these contexts with enforced consistency rules
§Trust Boundary Enforcement
The type system prevents accidental cross-boundary leakage:
PublicContextimplementsDisplayfor external renderingInternalContextimplementsDisplayas redacted placeholder only- No implicit conversions exist between these types
§Feature Gates
When external_signaling is disabled, PublicTruth variant is unavailable at
compile time. This forces all external outputs to use DeceptiveLie, ensuring
honeypot deployments cannot accidentally expose truthful diagnostic information.
§Memory Safety Strategy
Sensitive data receives best-effort clearing from memory on drop:
- Owned strings: Cleared via
zeroizecrate (handles heap buffers) - Compiler optimization: Volatile writes prevent LLVM dead-store elimination
- Instruction ordering: Compiler fences prevent reordering across security boundaries
§What This Does NOT Guarantee
- Hardware cache visibility: Compiler fences do not flush CPU caches
- Cross-thread guarantees: Other threads may observe old values in cache
- Allocator-level security: Memory may be reallocated before physical clearing
- DMA or swap: OS/hardware may have copied data before zeroization
This protects against compiler optimizations and casual memory inspection. It does NOT provide HSM-grade secure memory wiping. For that, use platform-specific APIs (mlock, SecureZeroMemory, etc.) and dedicated secure allocators.
Structs§
- Dual
Context Error - Dual-context error model for honeypot systems with constructor-enforced invariants.
- Internal
Context - Type-safe wrapper for internal-only error contexts.
- Public
Context - Type-safe wrapper for public-facing error contexts.
- SocAccess
- Capability token for accessing sensitive internal context data.
Enums§
- Internal
Payload - Zero-allocation internal payload for SOC logging.
- Operation
Category - Operation category for contextualizing errors without revealing architecture.