Smart Log Redactor - VS Code Extension
Transform sensitive data redaction from a manual process into a seamless, automated VS Code experience. Detect and redact emails, API tokens, credit cards, and more directly in your editor.
Features
✨ Real-Time Detection
- Detect 50+ types of sensitive data patterns
- Color-coded confidence indicators
- Real-time detection as you edit
🔄 Auto-Redaction
- Automatically redact on save
- Customize masking strategies
- Create backups before redaction
🎨 Interactive Sidebar Panel
- Visual detection summary
- Confidence breakdown
- Quick action buttons
- Live statistics
⚡ Fast & Simple
- One-click file redaction
- Redact selected text inline
- Works with .log and .jsonl files
📋 Audit Trail
- Track all redaction operations
- Backup management
- Compliance logging
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Smart Log Redactor"
- Click Install
Manual Installation (Development)
# Clone the repository
git clone https://github.com/yourusername/smart-log-redactor.git
cd smart-log-redactor/vscode-extension
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Or watch for changes during development
npm run watch
Requirements
- VS Code: 1.80.0 or later
- Python: 3.7 or later (with redactor_engine.py in workspace)
- Log Files: .log, .jsonl, .json, .csv, .tsv formats supported
Quick Start
1. Basic Setup
# Ensure redactor_engine.py is in your workspace root
# Then open a log file in VS Code
2. Detect Sensitive Data
Press: Ctrl+Shift+R (Windows/Linux) or Cmd+Shift+R (Mac)
Or: Right-click file > "Redact Current File"
Result:
- Detections appear in sidebar panel
- Redacted file is saved to
redacted_logs/ directory
- Original file is backed up (optional)
3. View Detections
Click: "🔍 Analyze for Sensitive Data" in sidebar
Shows:
- Total items found
- Confidence scores (high/medium/low)
- Breakdown by sensitive data type
Usage
Via Command Palette (Ctrl+Shift+P)
> Smart Log Redactor: Redact Current File
> Smart Log Redactor: Redact Selected Text
> Smart Log Redactor: Show Detections
> Smart Log Redactor: Toggle Auto-Redact on Save
> Smart Log Redactor: Settings
On Files:
- Right-click .log file → "Redact Current File"
In Editor:
- Right-click selected text → "Redact Selected Text"
Via Keyboard
| Action |
Windows/Linux |
Mac |
| Redact File |
Ctrl+Shift+R |
Cmd+Shift+R |
| (Add more as needed) |
|
|
Configuration
Settings (Ctrl+,)
Search for "smartLogRedactor" to access settings:
{
// Enable/disable the extension
"smartLogRedactor.enabled": true,
// Auto-redact files when saved
"smartLogRedactor.autoRedactOnSave": false,
// Masking strategy
"smartLogRedactor.maskingStrategy": "hash", // full, partial, hash, format-preserving
// Minimum confidence level (0-1)
"smartLogRedactor.confidenceThreshold": 0.5,
// Create backup before redaction
"smartLogRedactor.createBackups": true,
// Output directory for redacted files
"smartLogRedactor.outputDirectory": "redacted_logs",
// Python executable path
"smartLogRedactor.pythonPath": "python"
}
Masking Strategies
1. Full Mask (*** or [REDACTED])
Before: password=SuperSecret123
After: password=***
2. Partial Mask (Keep first/last chars)
Before: john.doe@company.com
After: j***.d*@company.com
3. Hash Mask (Deterministic hashing)
Before: john.doe@company.com
After: [HASH_a1b2c3d4]
4. Format-Preserving (Maintain structure)
Before: john.doe@company.com
After: xxxx.xxxx@company.com
Examples
Scenario 1: Redact a Production Log File
1. Open prod.log in VS Code
2. Press Ctrl+Shift+R
3. Extension detects:
- 15 API tokens
- 8 database credentials
- 12 email addresses
4. Saves redacted version to: redacted_logs/prod.log.redacted.20260409
5. Original file backed up to: redacted_logs/backups/prod.log.backup.20260409_143022
Scenario 2: Auto-Redact on Save
1. Enable in settings: "smartLogRedactor.autoRedactOnSave": true
2. Open app.log
3. Make edits and save (Ctrl+S)
4. Extension automatically redacts and saves result
5. No manual action needed
Scenario 3: Redact Selected Text
1. Open any file
2. Select sensitive text: "sk_live_abc123..."
3. Press Ctrl+Shift+P
4. Choose "Smart Log Redactor: Redact Selected Text"
5. Text is replaced with redacted version inline
Supported Patterns
The extension detects 50+ sensitive data patterns:
- Email addresses
- Phone numbers
- Social Security Numbers (SSN)
- Passport numbers
- UUIDs
Credentials & Secrets
- API keys (OpenAI, Stripe, etc.)
- JWT tokens
- OAuth tokens
- Passwords
- Database connection strings
Financial Data
- Credit card numbers (Visa, MasterCard, Amex)
- Bank account numbers
- IBAN codes
- Routing numbers
Network & Infrastructure
- IP addresses (IPv4, IPv6)
- MAC addresses
- URLs with credentials
- Hostnames
Identifiers
- AWS access keys
- SSH keys
- Private keys (RSA, DSA)
- Certificates
Other
- Slack webhooks
- GitHub tokens
- Docker image references
- And more...
Troubleshooting
Issue: "Python not found" error
Solution:
- Go to Settings (Ctrl+,)
- Search for "pythonPath"
- Set correct path:
- Windows:
python.exe or C:\Python39\python.exe
- Mac/Linux:
/usr/bin/python3 or python3
Issue: Extension doesn't detect sensitive data
Check:
- File size not too large (>100MB)
- File is readable text (not binary)
- Pattern matches your data format
- Confidence threshold not too high
Solution:
- Lower confidence threshold in settings
- Check file encoding (should be UTF-8)
- Test with sample_log.log from project
Issue: Redacted file has wrong content
Check:
- Original file still exists in backups/ folder
- Verify masking strategy is correct
- Check Python redactor_engine.py is available
Solution:
- Restore from backup
- Change masking strategy and retry
- Ensure workspace has redactor_engine.py
- Detection Speed: <50ms for typical logs
- Large Files: <5 seconds for 100MB file
- Memory Usage: <100MB for typical usage
- Sidebar Updates: Real-time, sub-100ms
Security
✅ Local Processing: All redaction happens locally on your machine
✅ No Data Upload: Files never leave your system
✅ No Persistence: Results not stored after processing
✅ Audit Logging: Track all operations for compliance
Keyboard Shortcuts
Create custom shortcuts in VS Code:
// In keybindings.json (Ctrl+K Ctrl+S)
[
{
"key": "ctrl+shift+r",
"command": "smartLogRedactor.redactFile",
"when": "editorFocus && resourceExtname =~ /\\.(log|jsonl)$/"
}
]
Contributing
Found a bug? Have a feature request?
- Open an issue on GitHub
- Provide the log file pattern causing issues
- Include VS Code version and Python version
Changelog
v1.0.0 (Stable Release)
- ✅ Real-time detection
- ✅ 50+ pattern library
- ✅ 4 masking strategies
- ✅ Auto-redact on save
- ✅ Sidebar panel
- ✅ Audit logging
License
MIT License - See LICENSE file
Support
- Documentation: See IMPLEMENTATION_GUIDE.md
- Testing: See TESTING_GUIDE.md
- Issues: GitHub issues tracker
Happy Redacting! 🛡️
For questions or feedback, open an issue on the GitHub repository.