| Crates.io | scrub-db |
| lib.rs | scrub-db |
| version | 0.2.0 |
| created_at | 2025-11-14 14:28:03.508436+00 |
| updated_at | 2025-11-19 14:35:24.542187+00 |
| description | Manual database anonymization tool - Free version |
| homepage | |
| repository | https://github.com/joyen12/scrub-db |
| max_upload_size | |
| id | 1932974 |
| size | 50,387 |
Fast, manual database anonymization for development and testing.
Scrub-DB is a powerful database anonymization engine that helps you safely anonymize SQL dumps. The free version provides manual configuration via YAML files, while Pro offers automatic PII detection and live database connections.
scrub-db.yamlscrub-db.yaml in your working directory# Install
cargo install scrub-db
# 1. Scan SQL dump to see what PII would be detected (Pro preview)
cat dump.sql | scrub-db scan
# 2. Create a config file with your anonymization rules
cat > scrub-db.yaml <<EOF
preserve_relationships: true
custom_rules:
email: fake_email
phone: fake_phone
credit_card: mask_credit_card
EOF
# 3. Anonymize SQL dump
cat dump.sql | scrub-db > anonymized.sql
# Or pipe directly from pg_dump
pg_dump mydb | scrub-db > safe-dump.sql
# Use custom config file location
cat dump.sql | scrub-db -c my-config.yaml > anonymized.sql
Create a scrub-db.yaml file with your anonymization rules:
preserve_relationships: true
custom_rules:
email: fake_email
phone: fake_phone
ssn: mask_ssn
credit_card: mask_credit_card
Available Methods:
fake_email - Generate realistic fake emailsfake_name - Generate realistic fake namesfake_phone - Generate realistic fake phone numbersfake_address - Generate realistic fake addressesmask_credit_card - Mask all but last 4 digitsmask_ssn - Completely mask SSNshash - SHA-256 hash of the valueskip - Leave unchangedWhen enabled (default), the same input always generates the same output:
john.doe@example.com → alice.smith@example.com
john.doe@example.com → alice.smith@example.com (same!)
This preserves foreign key relationships and data integrity.
The free version includes a scan command that shows you what PII would be automatically detected in the Pro version:
$ cat dump.sql | scrub-db scan
🔍 Scrub-DB Scan - PII Detection Preview
=========================================
✨ Scan Results:
📧 3 lines with potential email addresses
📱 3 lines with potential phone numbers
💳 0 lines with potential credit card numbers
🚀 Upgrade to Scrub-DB Pro for automatic detection!
This helps you write your manual config rules.
scrub-db [OPTIONS] [COMMAND]
Commands:
scan Scan SQL dump for potential PII (Pro feature preview)
Options:
-c, --cfg <FILE> Config file (auto-detects scrub-db.yaml if not specified)
--stdin Force stdin mode (auto-detected by default)
-h, --help Print help
-V, --version Print version
Usage:
# Anonymize with config file
cat dump.sql | scrub-db > anonymized.sql
# Scan for PII
cat dump.sql | scrub-db scan
# Use specific config file
cat dump.sql | scrub-db -c custom.yaml > anonymized.sql
Want more power? Scrub-DB Pro includes:
| Feature | Free | Pro |
|---|---|---|
| Manual config (YAML) | ✅ | ✅ |
| Stdin/stdout processing | ✅ | ✅ |
| Relationship preservation | ✅ | ✅ |
| Automatic PII detection | ❌ | ✅ |
| Live database connections | ❌ | ✅ |
| Database-to-database copy | ❌ | ✅ |
| Schema introspection | ❌ | ✅ |
| Smart column analysis | ❌ | ✅ |
| Cloud DB support (RDS, Cloud SQL) | ❌ | ✅ |
| Priority support | ❌ | ✅ |
Pricing:
Visit https://scrub-db.com to upgrade →
1. First, scan to see what PII is present:
$ cat test-dump.sql | scrub-db scan
🔍 Scrub-DB Scan - PII Detection Preview
✨ Scan Results:
📧 3 lines with potential email addresses
📱 3 lines with potential phone numbers
2. Create config file based on scan:
$ cat > scrub-db.yaml <<EOF
preserve_relationships: true
custom_rules:
email: fake_email
phone: fake_phone
EOF
3. Anonymize the dump:
$ cat test-dump.sql | scrub-db
INSERT INTO users (id, email, phone) VALUES (1, 'adrain@example.com', '555-123-4567');
INSERT INTO users (id, email, phone) VALUES (2, 'kaitlin@example.org', '555-987-6543');
INSERT INTO users (id, email, phone) VALUES (3, 'adrain@example.com', '555-555-5555');
Notice: john.doe@example.com became adrain@example.com in both rows 1 and 3 - relationship preservation in action!
The project includes comprehensive unit tests covering all critical functionality:
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test
cargo test test_detect_postgres_from_sql
Test Coverage:
Free Version (v0.1.0 - Current):
scrub-db.yaml)scan command (Pro feature preview)Pro Version (In Development):
Enterprise Version (Planned):
MIT OR Apache-2.0