palisade-config
Security-focused configuration and policy crate for deception/honeypot systems.
What this crate provides
- Typed
ConfigandPolicyConfigmodels with multi-layer validation - Cryptographic tag derivation via
RootTag(SHA3-512 hierarchy) - Runtime no-allocation representations (
RuntimeConfig,RuntimePolicy) - Centralized timing-floor profiles (
TimingProfile::Balanced/Hardened) - Config/policy diffing for safe hot-reload workflows
- Security-oriented error model via
palisade-errors
Version
Current crate version: 1.0.2
Installation
[]
= "1.0.2"
Prerequisites: file permissions
Config::from_file and PolicyConfig::from_file enforce Unix file permissions
before reading. Config and policy files must be 0o600 (owner read/write only):
Any other permission mode (e.g. default 0o644) will return a security violation
error before any content is read. This is enforced, not optional.
Quick start
1) Generate a root tag
The root_tag field in config.toml requires a 64-character hex-encoded 256-bit secret
with sufficient entropy (non-zero, non-sequential, ≥25% unique bytes):
Paste the output into your config.toml as the root_tag value.
2) Load and validate config/policy
from_file runs standard validation automatically. Calling validate() again is
redundant — it is only needed when validating a config constructed in-process
(e.g. from Config::default() or after manual field mutation).
use ;
async
For strict validation (paths must exist, log directory must be writable):
use ;
let cfg = from_file_with_mode.await?;
3) Convert to runtime no-alloc mode
use Config;
4) Policy checks at runtime
use PolicyConfig;
5) Hot-reload via diff
Diff exposes only what changed — safe to apply, log, or reject at your discretion:
use ;
6) Set timing profile
use ;
Architecture
Config vs policy
Config |
PolicyConfig |
|
|---|---|---|
| Purpose | Infrastructure mechanics | Detection/response logic |
| Contains | Paths, logging, telemetry, root tag | Thresholds, rules, suspicious patterns |
| Secret material | Yes (RootTag) |
No |
| File sensitivity | High | Medium |
Validation modes
Standard (default via from_file): format checks, range checks, entropy checks.
No filesystem access beyond reading the config file itself.
Strict (via from_file_with_mode): all Standard checks plus path existence,
parent directory existence, and log directory write-access verification.
Use in production; Standard is appropriate for CI environments where
monitored paths may not exist.
Runtime no-alloc layer
to_runtime() converts deserialized models into fixed-capacity runtime types
backed by heapless. All hot-path operations on RuntimeConfig and RuntimePolicy
are designed for zero heap allocation.
Fixed capacities (see runtime.rs):
| Constant | Default |
|---|---|
MAX_PATH_LEN |
512 bytes |
MAX_LABEL_LEN |
64 bytes |
MAX_PATH_ENTRIES |
64 |
MAX_CREDENTIAL_TYPES |
32 |
MAX_SUSPICIOUS_PROCESSES |
128 |
MAX_SUSPICIOUS_PATTERNS |
128 |
MAX_CUSTOM_CONDITIONS |
128 |
Cryptographic tag hierarchy
root_tag (256-bit secret)
└── host_tag = SHA3-512(root_tag || hostname)
└── artifact_tag = SHA3-512(host_tag || artifact_id)
Tags are deterministic — same inputs always produce the same tag. Rotating the root tag breaks all artifact correlations simultaneously.
Timing model
All security-sensitive operations have minimum execution floors applied via
enforce_operation_min_timing. This reduces coarse timing side-channel leakage;
it is not a full side-channel proof (see SECURITY.md).
| Profile | Use case |
|---|---|
Balanced (default) |
Lower latency, moderate smoothing |
Hardened |
Higher floors, stronger timing smoothing |
Examples
See examples/:
toml_loading.rs— load config and policy from TOML files, validate, run policy checksfull.rs— full integration: startup, runtime conversion, tag binding, incident scoring, hot-reload, shutdown
Run with:
# Requires examples/config.toml and examples/policy.toml with chmod 600
See examples/config.toml and examples/policy.toml for reference templates.
Benchmark analysis utility
Script: scripts/analyze_bench_results.py
Usage: scripts/ANALYZE_BENCH_RESULTS_USAGE.md
License
Apache-2.0