| Crates.io | cleansh |
| lib.rs | cleansh |
| version | 0.1.11 |
| created_at | 2025-07-12 15:02:46.074574+00 |
| updated_at | 2025-12-20 15:52:29.374114+00 |
| description | Sanitize your terminal output. One tool. One purpose. |
| homepage | https://github.com/KarmaYama/cleansh-workspace |
| repository | https://github.com/KarmaYama/cleansh-workspace |
| max_upload_size | |
| id | 1749397 |
| size | 412,615 |
Contributing Guidelines | Code of Conduct | Changelog | Security Policy | Trademark Policy | Command Handbook
CleanSH (clean shell) is a high‑trust, single‑purpose CLI tool designed to sanitize terminal output for safe sharing. It prioritizes security by default, requires zero configuration to get started, and offers extendability when needed. The project is in active development, with
v0.1.11bringing significant enhancements to redaction accuracy, security, and user control. We value your feedback. Please report any issues you encounter. Star the repository if you like it!
| Section |
|---|
| 1. Overview |
| 2. License (Open Core) |
| 3. Core Capabilities |
| 4. The New Entropy Engine |
| 5. Usage Examples |
| 6. Configuration Strategy |
| 7. Future Vision |
| 8. Installation |
CleanSH is a powerful and reliable command‑line utility designed to help you quickly and securely redact sensitive information from your terminal output.
Whether you're debugging, collaborating, or sharing logs, CleanSH ensures that confidential data like IP addresses, email addresses, and access tokens never leave your local environment unmasked. Piped directly from stdin or loaded from files, CleanSH provides a robust, pre‑configured solution for data sanitization, with flexible options for custom rules and output formats.
Sanitize your terminal output. One tool. One purpose.
CleanSH is now Open Source.
cleansh profiles sync) will be part of the Relay Enterprise platform but are currently inactive stubs in the open-source CLI.The restrictive "PolyForm" license has been retired for all versions v0.1.9+.
Based on our rigorously passing test suite, CleanSH accurately masks:
user@example.com).ghp_…, github_pat_…)sk_live_…)/home/user -> ~/).cleansh sanitize: The core redaction loop.cleansh scan: Audit files for secrets without modifying them (Exit code support for CI/CD).cleansh profiles: Manage local rule configurations.New in v0.1.9: CleanSH now includes a context-aware Entropy Engine alongside its Regex core.
Standard regex rules require you to know the format of a secret (e.g., "starts with sk_live_"). But what about a random 32-character database password or a custom API key? If you don't have a regex for it, standard tools will miss it.
The Entropy Engine solves this by detecting statistical anomalies—tokens that are mathematically too random to be natural language or code.
Most entropy scanners fail because of the Self-Reference Paradox: when they calculate the "average randomness" of a text block to see if a token is an outlier, they include the token itself in that average. A high-entropy secret inflates the baseline, effectively hiding itself.
The CleanSH Solution: "Leave-One-Out" Baseline Our engine uses a rigorous statistical approach:
8x9#bF2!kL), we calculate the baseline entropy of the surrounding context while mathematically excluding the token itself.key, auth, secret) using an Aho-Corasick automaton. A match here lowers the statistical threshold required to flag the secret.The Entropy Engine is opt-in because it is computationally more intensive than regex.
To enable it for a single run:
# Scan with BOTH Regex and Entropy engines
cat production.log | cleansh sanitize --engine entropy
When to use it:
Basic Sanitization:
echo "My email is test@example.com" | cleansh sanitize
Using the Entropy Engine:
cat unknown_logs.txt | cleansh sanitize --engine entropy
CI/CD Scan (Fail if secrets found):
cat build.log | cleansh scan --fail-over-threshold 0
Docker Logs:
docker logs my-container | cleansh sanitize
Clipboard Copy:
git config --list | cleansh sanitize -c
Diff View:
cat error.log | cleansh sanitize -d
--config)Define your own regex rules in a YAML file:
rules:
- name: emp_id
pattern: 'EMP-\d{5}'
replace_with: '[EMPLOYEE_ID]'
pattern_type: "regex"
opt_in: false
Control rules on the fly:
cleansh sanitize --enable "uk_nino,aws_secret_key" --disable "email"
CleanSH is evolving into an intelligent security assistant.
Download from GitHub Releases.
cargo install cleansh
git clone [https://github.com/KarmaYama/cleansh-workspace.git](https://github.com/KarmaYama/cleansh-workspace.git)
cd cleansh
cargo build --release
Precision redaction. Local‑only trust. Built for devs.
Copyright 2025 Relay.