8000 GitHub - KennethDenson/redact.sh: I find myself needing to share files that contain sensitive data and got tired of having to redact things by hand. This "kinda" works.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

I find myself needing to share files that contain sensitive data and got tired of having to redact things by hand. This "kinda" works.

License

Notifications You must be signed in to change notification settings

KennethDenson/redact.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redact.sh

redact.sh is a dead-simple Bash script that redacts sensitive values from config files like .env, .json, and .yaml for safe sharing on support forums, Discord, or ChatGPT. It highlights redacted lines in red so you can quickly verify what's been scrubbed.


🚀 Features

  • ✅ Redacts full values for keys like API_KEY, PASSWORD, SECRET_KEY, etc.
  • ✅ Reads custom patterns from .redact-patterns
  • ✅ Supports .env, .json, and .yaml formats
  • ✅ Highlights redacted lines in red in your terminal
  • ✅ POSIX-compatible (works on macOS, Linux, WSL)

🧠 Example

Input:

API_KEY=abcd1234
"api_key": "abcd1234",
api_key: abcd1234
SAFE_VAR=ThisIsFine

Output:

API_KEY=REDACTED               ← in red
"api_key": "REDACTED",         ← in red
api_key: REDACTED              ← in red
SAFE_VAR=ThisIsFine

🛠️ Usage

./redact.sh path/to/your/file.env

Want to test it?

./redact.sh sample.env

🧩 Customize Keys

Edit .redact-patterns to specify which keys should be redacted (case-insensitive):

API_KEY
PASSWORD
SECRET_KEY
JWT
DB_USER

📦 Installation (Optional)

If you want to make it globally available:

chmod +x redact.sh
sudo ln -s "$(pwd)/redact.sh" /usr/local/bin/redact

Now you can run:

redact myfile.env

🪪 License

MIT — do whatever you want, but don't blame me if you nuke your prod secrets 😇

About

I find myself needing to share files that contain sensitive data and got tired of having to redact things by hand. This "kinda" works.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0