A CLI tool to automatically strip PII (Personally Identifiable Information) and corporate information from clipboard content before pasting.
Built with Microsoft Presidio for robust PII detection and anonymisation.
-
Detects and redacts common PII:
- Names, email addresses, phone numbers
- Credit cards, SSNs, passports, driver licences
- IP addresses, URLs, dates
- Medical licences, bank account numbers
- And much more (see supported entities)
-
Custom corporate information redaction:
- Company/organisation names
- Internal domains and URLs
- Project/product code names
- Custom deny-list terms
-
Multiple usage modes:
- CLI command for manual scrubbing
- macOS keyboard shortcut for quick access
- Pipe mode for integration with other tools
- Python 3.8 or higher
- macOS (uses
pbcopy/pbpastefor clipboard access)
- The repository can be cloned or downloaded:
cd ~/Github/SecureCopyPaste- The package is then installed:
# Install in development mode (recommended for easy updates)
pip install -e .
# Or install normally
pip install .- The spaCy NLP model must be downloaded (required for name/location detection):
python -m spacy download en_core_web_lgThis may take a few minutes as the model is ~500MB.
- (Optional) A configuration file can be created:
scrub --init-configThis creates ~/.config/scrub/config.yaml with example corporate terms. This file can be edited to include company names, domains, project names, and deny-list terms.
# Scrub clipboard in-place (reads clipboard, scrubs, writes back)
scrub
# Read from stdin, output to stdout
echo "Call John Doe at 555-1234" | scrub --stdin
# Output: Call <PERSON> at <PHONE_NUMBER>
# Dry-run: see what would be redacted without modifying clipboard
scrub --dry-run
# Use custom config file
scrub --config /path/to/config.yaml
# Show version
scrub --versionInput (clipboard):
Hi, I'm Jane Smith from Acme Corp.
Email me at jane.smith@acme.com or call 555-123-4567.
Our internal system is at https://internal.acme.io
Credit card: 4532-1488-0343-6467
After running scrub:
Hi, I'm <PERSON> from <CORPORATE_NAME>.
Email me at <EMAIL_ADDRESS> or call <PHONE_NUMBER>.
Our internal system is at <INTERNAL_DOMAIN>
Credit card: <CREDIT_CARD>
The config file at ~/.config/scrub/config.yaml allows for the specification of corporate information to redact:
corporate:
# Company/organisation names
company_names:
- "Acme Corp"
- "Acme Inc"
# Internal domains (matches in URLs and emails)
domains:
- "acme.com"
- "internal.acme.io"
# Project/product code names
project_names:
- "Project Phoenix"
- "Codename Titan"
# Custom terms to always redact
deny_list:
- "confidential-system-name"
- "internal-tool-v2"A complete example is available in config/config.example.yaml.
For quick access, a keyboard shortcut can be set up to run scrub automatically.
-
Shortcuts.app can be opened (comes with macOS).
-
A new shortcut is created by clicking the + button.
-
A "Run Shell Script" action is added:
- Search for "Run Shell Script" in the actions sidebar
- Drag it to the workflow
-
The shell script is configured as follows:
- Shell:
/bin/bash - Pass input: (doesn't matter)
- Script content:
/usr/local/bin/scrub
Note: The
scrubpath can be found with:which scrub - Shell:
-
The shortcut is saved with a name like "Scrub Clipboard".
-
A keyboard shortcut is assigned:
- Right-click the shortcut → Add Keyboard Shortcut
- Press the desired key combination (e.g.,
Cmd+Shift+VorCtrl+Shift+S) - Ensure the shortcut is not already in use by another application.
-
Testing:
- Copy text with PII to the clipboard
- Press the keyboard shortcut
- Paste to verify the content was scrubbed
-
Automator (in Applications) is opened.
-
A new Quick Action is created.
-
The workflow is configured:
- "Workflow receives": no input in any application
- Add action: Run Shell Script
- Shell:
/bin/bash - Pass input: as arguments
- Script:
/usr/local/bin/scrub
-
Saved as "Scrub Clipboard".
-
A keyboard shortcut is assigned:
- Open System Settings → Keyboard → Shortcuts
- Select Services in the sidebar
- Find "Scrub Clipboard" under General
- Click Add Shortcut and press the desired keys
For Warp users, an alias or function can be created in the shell profile:
# Add to ~/.zshrc or ~/.bashrc
alias scrub-clip='scrub'
# Or create a function that shows a notification
function scrub-clip() {
scrub && echo "✓ Clipboard scrubbed"
}SecureCopyPaste/
├── pyproject.toml # Project metadata and dependencies
├── README.md # This file
├── config/
│ └── config.example.yaml # Example configuration
└── src/
└── scrub/
├── __init__.py # Package init
├── cli.py # CLI entry point
├── clipboard.py # macOS clipboard utilities
├── config.py # Configuration management
├── scrubber.py # Core Presidio integration
└── recognisers/ # Custom PII recognisers
├── corporate.py # Company name detection
├── domains.py # Internal domain detection
└── denylist.py # Custom deny-list terms
# Install dev dependencies
pip install -e ".[dev]"
# Run tests (when available)
pytestThis tool requires macOS. The clipboard commands are macOS-specific.
Ensure the model has been downloaded:
python -m spacy download en_core_web_lgPresidio uses confidence scores. Some entities may not be detected if:
- The confidence score is too low
- The text doesn't match expected patterns
- The NLP model doesn't recognise the entity
Use --dry-run to see what is detected.
- Ensure the
scrubcommand works from the terminal first - Verify the path to
scrubin the shortcut matcheswhich scrub - Check that the keyboard shortcut isn't already in use
- macOS may require permissions for Shortcuts/Automator to run shell commands
- Presidio uses automated detection and may not catch all PII
- Scrubbed content should always be reviewed before sharing sensitive information
- This tool serves as a helpful safeguard, not a guarantee
- Config files may contain sensitive corporate terms - protect accordingly
MIT
- Built with Microsoft Presidio
- Uses spaCy for NLP