1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// cleansh-core/src/lib.rs
//! # CleanSH Core Library
//!
//! `cleansh-core` provides the fundamental, platform-independent logic for data sanitization,
//! redaction, and **proactive threat remediation**.
//!
//! Starting with v0.2.0, CleanSH transitions from a passive text filter to an active
//! security partner. It implements a "Self-Healing Engine" that can verify and neutralize
//! leaked secrets in real-time while maintaining zero-latency terminal performance.
//!
//! ## Core Architecture
//!
//! * **Sanitization Engines**: Locates sensitive patterns using Regex or statistical Entropy.
//! * **Self-Healing Orchestrator**: Manages the lifecycle of a detected secret—Verification,
//! Remediation (Revocation), and Global Fingerprint Propagation.
//! * **Triple-Lock Safety**: Ensures stability via Pre-flight checks, Confidence-Gating,
//! and a Remediation Governor (Rate-Limiter).
//!
//! ## Modules
//!
//! * `config`: Defines `RedactionRule`s and `RedactionConfig` for specifying sensitive patterns.
//! * `sanitizers`: Contains engine-specific logic for compiling rules.
//! * `validators`: Provides programmatic validation for specific data types.
//! * `redaction_match`: Defines data structures for detailed reporting of redaction events.
//! * `engine`: Defines the `SanitizationEngine` trait, enabling a modular design.
//! * `profiles`: Defines data structures for user-specified profiles and post-processing.
//! * `audit_log`: Defines the structure and logic for writing redaction events to a log file.
//! * `engines`: Contains concrete implementations of the `SanitizationEngine` trait.
//! * `headless`: Convenience wrappers for using core engines in a non-interactive mode.
//! * `remediation`: **(v0.2.0)** The Self-Healing framework, including providers and orchestrators.
//!
//! ## Usage Example (Proactive Healing)
//!
//! ```rust
//! use cleansh_core::{RedactionConfig, EntropyEngine, HeadlessEngineType, SanitizationEngine}; // <--- Fixed: Added SanitizationEngine trait import
//! use cleansh_core::remediation::orchestrator::SelfHealingEngine;
//! use tokio::sync::mpsc;
//! use std::sync::Arc;
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! let config = RedactionConfig::load_default_rules()?;
//! let mut engine = EntropyEngine::new(config)?;
//!
//! // 1. Setup the Remediation Channel
//! let (tx, rx) = mpsc::channel(100);
//!
//! // This method requires the SanitizationEngine trait to be in scope
//! engine.set_remediation_tx(tx);
//!
//! // 2. Initialize the Self-Healing Orchestrator
//! // We wrap it in an Arc as required by the 'listen' method for async safety.
//! let orchestrator = Arc::new(SelfHealingEngine::new(vec![], None, 5, true, vec![0u8; 32]));
//!
//! // 3. Start the background listener
//! orchestrator.listen(rx);
//!
//! Ok(())
//! }
//! ```
//!
//! ---
//! License: MIT OR APACHE 2.0
// Module declarations
// Re-exports
pub use ;
pub use CleanshError;
pub use SanitizationEngine;
pub use RegexEngine;
pub use EntropyEngine;
pub use ;
pub use ;
pub use AuditLog;
pub use ;
pub use ;
// Remediation re-exports for easy access
pub use ;