A Chrome extension that automatically sanitizes pasted content by replacing sensitive information with dummy values.
Safe Paste protects you from accidentally pasting sensitive information by automatically detecting and replacing:
- API Keys - Generic and service-specific API keys
- AWS Access Keys - AKIA format keys
- AWS Secret Keys - Base64 encoded secrets
- JWT Tokens - JSON Web Tokens (eyJ... format)
- Certificates - PEM format certificates
- Private Keys - RSA and other private keys in PEM format
- MD5 - 32 character hexadecimal
- SHA-1 - 40 character hexadecimal
- SHA-256 - 64 character hexadecimal
- Email Addresses - user@domain.com format
- Credit Card Numbers - Various formats with/without hyphens
- Social Security Numbers - XXX-XX-XXXX format (US)
- Phone Numbers - Various international formats
- IPv4 Addresses - 192.168.x.x format
- IPv6 Addresses - Full IPv6 format
- URLs with Tokens - URLs containing token/key/auth parameters
- Plain Text - Any unstructured text content
- JSON - Structured JSON with nested objects
- YAML - Configuration files
- XML - Markup documents
- Clone or download this repository
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" in the top right
- Click "Load unpacked"
- Select the repository directory
Once installed, Safe Paste works automatically:
- Copy any content containing sensitive information
- Paste anywhere - the extension automatically sanitizes it
- See notification - A green notification confirms sanitization occurred
Click the Safe Paste icon in your Chrome toolbar to:
- Toggle protection on/off
- View list of protected data types
- See supported formats
- Access Custom Keywords Settings
You can define your own keywords and replacement values:
- Click the Safe Paste icon in your Chrome toolbar
- Click "Custom Keywords Settings" or right-click the extension and select "Options"
- Add a keyword (e.g., "password") and its replacement (e.g., "foo")
- When you paste text containing the keyword, it will be automatically replaced
Custom keywords are:
- Case-insensitive (matches "Password", "PASSWORD", "password", etc.)
- Applied before built-in sanitization patterns
- Stored locally in your browser
Before: My email is john.doe@company.com
After: My email is user123@example.com
Before:
{
"email": "admin@company.com",
"api_key": "sk_live_1234567890abcdef",
"password": "mySecretPass"
}
After:
{
"email": "dummy.user@example.com",
"api_key": "DUMMY_TOKEN_abc123xyz",
"password": "DUMMY_PASSWORD_123"
}Before:
api_key: sk_live_1234567890
email: user@example.com
password: secretpass123
After:
api_key: DUMMY_TOKEN_abc123xyz
email: dummy.user@example.com
password: DUMMY_PASSWORD_123- Intercepts Paste Events - Content script captures paste events
- Detects Format - Identifies JSON, YAML, or plain text
- Pattern Matching - Uses regex patterns to find sensitive data
- Smart Replacement - Replaces with realistic dummy values
- Seamless Insertion - Inserts sanitized content naturally
- All processing is local - No data is sent to external servers
- No storage - Pasted content is not saved or logged
- No tracking - Extension doesn't track your usage
- Open source - Full source code available for review
node test.jsAll 28 tests should pass.
safe-paste/
├── manifest.json # Extension configuration
├── content.js # Content script (paste interception)
├── sanitizer.js # Core sanitization logic
├── popup.html # Extension popup UI
├── popup.js # Popup functionality
├── options.html # Custom keywords settings page
├── options.js # Options page functionality
├── test.js # Test suite
├── icons/ # Extension icons
│ ├── icon16.png
│ ├── icon48.png
│ └── icon128.png
└── README.md # This file
To detect new sensitive data types:
- Add pattern to
patternsobject insanitizer.js - Add replacement function
- Add to sanitization order in
sanitizePlainText() - Add test case in
test.js
MIT License - Feel free to use and modify
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
If you discover a security vulnerability, please email the maintainers directly rather than opening a public issue.
For issues, questions, or suggestions, please open an issue on GitHub.