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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//! # SecretScout
//!
//! A blazingly fast, memory-safe CLI tool for detecting secrets, passwords, API keys,
//! and tokens in git repositories. Built with Rust for maximum performance and safety.
//!
//! ## Features
//!
//! - **10x Faster** - Rust-powered performance with intelligent caching
//! - **Memory Safe** - Zero buffer overflows, crashes, or memory leaks
//! - **Dual Mode** - Use as standalone CLI or GitHub Action
//! - **Pre-commit Hooks** - Protect staged changes before commit
//! - **Multiple Formats** - SARIF, JSON, CSV, text output
//! - **Zero Config** - Works out of the box with sensible defaults
//!
//! ## Installation
//!
//! ### Via cargo
//!
//! ```bash
//! cargo install secretscout
//! ```
//!
//! ### Via npm
//!
//! ```bash
//! npm install -g secretscout
//! ```
//!
//! ## CLI Usage
//!
//! ```bash
//! # Scan a repository
//! secretscout detect
//!
//! # Scan with custom config
//! secretscout detect --config .gitleaks.toml
//!
//! # Protect staged changes (pre-commit hook)
//! secretscout protect --staged
//! ```
//!
//! ## Library Usage
//!
//! This crate can also be used as a library for integrating secret scanning
//! into your own Rust applications:
//!
//! ```no_run
//! use secretscout::{Config, commands};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Scan a repository for secrets
//! commands::detect(
//! ".", // source path
//! "results.sarif", // report path
//! "sarif", // format
//! false, // redact
//! 2, // exit code on findings
//! None, // log options
//! None, // config path
//! false, // verbose
//! ).await?;
//! Ok(())
//! }
//! ```
//!
//! ## Architecture
//!
//! This library exposes modules for both native and WASM targets:
//!
//! - **Native mode** (`feature = "native"`): Full CLI and GitHub Actions functionality
//! - **WASM mode** (`feature = "wasm"`): Browser-based secret scanning
//!
//! ## Safety
//!
//! All code in this crate is memory-safe Rust with no unsafe blocks in the main logic.
//! We leverage Rust's ownership system and type safety to prevent common security vulnerabilities.
// Core modules (available in all modes)
// Native-only modules
// CLI-specific modules
// GitHub Actions-specific modules
// WASM-specific exports
// Re-exports for convenience
pub use Config;
pub use ;
pub use ;
pub use DetectedSecret;
/// Library version
pub const VERSION: &str = env!;
/// Check if running in native mode
/// Check if running in WASM mode