๐ Whiteout
Keep Your Secrets Secret
A Git filter tool that keeps sensitive code local while committing safe alternatives to your repository.
Features โข Installation โข Quick Start โข Usage โข How It Works โข Contributing
๐ฏ Problem
Ever accidentally committed an API key? Hardcoded a password for testing? Left debug code in production?
Whiteout solves this by letting you maintain local-only code that never reaches your Git repository, while preserving safe alternatives in commits.
// What you see locally:
const apiKey = "process.env.API_KEY"; // @whiteout: "sk-proj-SUPER-SECRET-KEY-123"
// What gets committed:
const apiKey = "process.env.API_KEY";
โจ Features
- ๐ Secure by Design - Secrets never touch Git history
- ๐จ Flexible Decorations - Multiple ways to mark sensitive code
- โก Fast - Written in Rust for optimal performance
- ๐ Seamless Integration - Works transparently with Git workflows
- ๐ Language Agnostic - Works with any text file or programming language
- ๐ฌ Multi-Comment Support - Works with
//,#,--comment styles - ๐ก๏ธ Safe Defaults - Requires explicit marking to prevent accidents
๐ฆ Installation
Prerequisites
- Git (version 2.0 or higher)
Install via Homebrew (macOS/Linux)
Install via Cargo (All platforms)
Install from Source
# Clone the repository
# Build and install
# Verify installation
Install on Arch Linux (AUR)
# Using yay
# Using paru
๐ Quick Start
1. Initialize in Your Project
This automatically:
- Creates
.whiteout/directory for local storage - Configures Git filters in your repository
- Adds necessary
.gitattributesentries
2. Mark Your Sensitive Code
Choose from multiple decoration styles that work with any comment format:
Inline Decoration
Works with any comment style (//, #, --):
// JavaScript
const apiKey = "sk-12345"; // @whiteout: "process.env.API_KEY"
# Python
= # @whiteout: "os.environ['API_KEY']"
-- SQL
SELECT * FROM users WHERE key = 'sk-12345'; -- @whiteout: 'REDACTED'
Block Decoration
Hide entire code blocks between markers:
// @whiteout-start
const DEBUG = true;
const SECRET_ENDPOINT = "http://localhost:3000";
console.log;
// @whiteout-end
const DEBUG = false; // This line stays in commits
Simple Decoration
For markdown or documentation, hide content after a marker:
This content is committed.
\@whiteout
This content stays local only.
It won't appear in commits.
Back to public content.
Partial Replacement
For configuration values within strings:
const url = "https://[[localhost:3000||api.example.com]]/v1";
// Locally: uses localhost:3000
// Committed: uses api.example.com
3. Work Normally
# Edit your files with secrets
# Commit as usual - secrets are automatically removed
# Your local files keep the secrets
๐ญ Decoration Patterns
Inline Pattern
Syntax: <code> // @whiteout: <replacement>
Note: When documenting examples, escape the @ with backslash: \@whiteout
# Local version:
= # @whiteout: "admin123"
# Committed version:
=
Block Pattern
Syntax: @whiteout-start ... @whiteout-end
# @whiteout-start
debug_mode: true
verbose_logging: true
test_endpoints:
- localhost:8080
# @whiteout-end
production_mode: true # This stays in commits
Simple Pattern
Syntax: @whiteout (hides everything until blank line)
Normal content here.
\@whiteout
Secret information.
More secrets.
Public content resumes.
Partial Pattern
Syntax: [[local||committed]]
[]
= "[[localhost||db.production.com]]"
= [[5432||3306]]
๐ Documentation Escape Sequences
When writing documentation about Whiteout (like this README), use backslash to escape decorators:
\@whiteout # Shows as @whiteout
\@whiteout-start # Shows as @whiteout-start
\@whiteout-end # Shows as @whiteout-end
@whiteout # Would hide content (without backslash)
๐ง Commands
Initialize Project
Manual Operations
# Apply clean filter (remove secrets)
# Apply smudge filter (restore secrets)
๐ How It Works
Whiteout uses Git's clean/smudge filter mechanism:
- Clean Filter (Working โ Repository): Removes decorated local values before commit
- Smudge Filter (Repository โ Working): Restores local values after checkout
graph LR
A[Working Directory<br/>with secrets] -->|git add<br/>clean filter| B[Staging Area<br/>secrets removed]
B -->|git commit| C[Repository<br/>safe version]
C -->|git checkout<br/>smudge filter| A
Local values are stored in .whiteout/local.toml (gitignored) and restored automatically.
๐ Whiteout vs .env Files
Both Whiteout and .env files solve secret management, but with different approaches:
Key Differences
| Aspect | Whiteout | .env Files |
|---|---|---|
| Where secrets live | Inline with code | Separate file |
| What you can hide | Values, code blocks, files | Environment variables |
| Git safety | Automatic via filters | Manual via .gitignore |
| Use case | Development & debugging | Configuration management |
Whiteout is Great For
- Inline secrets - See actual values where they're used
- Debug code - Hide entire blocks that shouldn't reach production
- Mixed visibility - Public and private code in the same file
.env Files are Great For
- Production config - Standard for deployment platforms
- Team workflows - Everyone knows how they work
- Docker/CI - Built-in support everywhere
They Work Well Together
Use each tool for what it does best:
// Production config from .env
const dbHost = process.env.DB_HOST;
// Development secrets inline with Whiteout
const apiKey = "process.env.API_KEY"; // @whiteout: "sk-dev-12345"
// Debug code that stays local
// @whiteout-start
console.log;
const DEBUG = true;
// @whiteout-end
๐ Security Considerations
- Never commit
.whiteout/directory (ensure it's in.gitignore) - Local values are stored in
.whiteout/local.toml - Backup your local values separately
- Use environment variables for production secrets
- Review commits before pushing to ensure secrets are removed
- Test filters work correctly before committing sensitive data
๐งช Testing
# Run all tests
# Run specific test
# Run with output
# Run integration tests
๐ Known Limitations / TODO
- Smudge operation after marker removal: When
@whiteoutmarkers are removed during the clean operation, the smudge filter cannot currently restore the hidden content when checking out files. This is a planned feature for a future release.
๐ค Contributing
Contributions are welcome!
Development
# Build
# Test
# Format code
# Lint
๐ License
MIT License - see LICENSE for details.