Palisade Errors
Security-conscious error handling for high-assurance Rust applications.
Palisade Errors is designed for systems where information leakage is a security vulnerability. Built as the foundational error handling layer for the Palisade Honeypot System, it enforces a strict separation between "what happened" (forensics) and "what the user sees" (sanitization), while guaranteeing that sensitive data in memory is zeroized immediately after use.
Current Version: 0.3.0
🎯 Design Philosophy
In a honeypot, every error is intelligence:
- For attackers: Errors reveal system architecture, validation logic, and attack surface
- For defenders: Errors provide forensic trails, attack correlation, and threat intelligence
Palisade Errors ensures attackers see only walls, while defenders see everything.
🚀 Key Features
- Forensic Integrity: Keep full stack traces, variable values, and internal state for your logs.
- Information Hiding: External error messages (
Display) are automatically sanitized to reveal only error codes and categories. - Memory Safety: All error context is wrapped in
ZeroizeOnDroptypes. Secrets are wiped from memory as soon as the error is dropped. - DoS Protection: Log outputs are strictly truncated to prevent memory exhaustion attacks.
- Strict Taxonomy: Optional feature flags to enforce rigid error categorization at compile time.
- Timing Attack Mitigation: Built-in normalization mechanisms to prevent side-channel leakage.
⚖️ Governance & Taxonomy
To maintain security boundaries in large-scale systems, this crate adheres to a strict governance contract regarding error namespaces, impact scores, and authority flags.
👉 Please refer to ERROR_GOVERNANCE.md for the complete taxonomy rules, authority models, and strict-mode feature flags.
⚡ Performance
This crate is architected for zero-leak memory management and microsecond-level predictability, even on legacy hardware.
👉 For detailed benchmarks, timing normalization analysis, and hardware validation, see BENCH_AVG.md.
📖 Usage
Basic Example
use ;
What the attacker sees:
Configuration operation failed [permanent] (E-CFG-104)
What your logs contain:
[1704652800] [E-CFG-104] operation='check_access'
details="User 'attacker' denied" source_ip=192.168.1.100
Handling Sensitive Data
When handling passwords, keys, file paths, or PII, use the sensitive constructors to ensure data is sequestered and zeroized:
use ;
let err = config_sensitive;
Security guarantee: When err is dropped, password_input is zeroized in memory. Core dumps cannot recover it.
Secure Logging
To access the internal details for your secure logs, use the internal_log() method. This returns a short-lived structure that prevents data retention:
// In your logging middleware
if let Err = result
Attack Correlation
Track attack patterns across errors using the metadata API:
let err = config_sensitive
.with_metadata
.with_metadata
.with_metadata;
// Process through correlation engine
correlator.track_error;
🏗️ Architecture
Attacker Request
↓
Application Logic (fails)
↓
┌─────────────────────────────────────┐
│ AgentError (palisade_errors) │
│ │
│ ┌────────────────────────────────┐ │
│ │ External (Display) │ │──→ Sanitized response to attacker
│ │ "Configuration failed (E-101)" │ │ (zero information leakage)
│ └────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────┐ │
│ │ Internal (InternalLog) │ │──→ Forensic logs
│ │ Full context + metadata │ │ (complete audit trail)
│ └────────────────────────────────┘ │
│ │
│ ┌────────────────────────────────┐ │
│ │ Sensitive (ZeroizeOnDrop) │ │──→ Restricted access logs
│ │ Credentials, paths, PII │ │ (encrypted, HSM-backed)
│ └────────────────────────────────┘ │
└─────────────────────────────────────┘
↓ (on drop)
Memory Zeroization
🛡️ Security Features
- Zero Information Disclosure: Attackers cannot distinguish between missing files, permission errors, or logic failures based on the external message.
- Memory Forensics Protection:
ZeroizeOnDropimplementation ensures sensitive strings are unrecoverable from RAM after use. - Timing Attack Resistance: Optional timing normalization primitives.
- DoS Protection: Automatic log truncation limits.
- Strict Taxonomy: Compile-time enforcement of error categorization via
strict_taxonomyfeature.
See SECURITY.md for the full threat model.
📄 License
Licensed under Apache-2.0.