Prompt Security

4 months ago 4

Go Version License PRs Welcome

Protect your clipboard before you paste!

Prompt Security is a blazing-fast, zero-config Go tool that automatically detects and filters sensitive data from your clipboard—before it can leak to large language models (LLMs) or online tools.


go install github.com/happytaoer/prompt-security@latest prompt-security monitor

Or build from source:

git clone https://github.com/happytaoer/prompt-security.git cd prompt-security go mod tidy go build -o prompt-security ./prompt-security monitor

  • Real-time clipboard monitoring
  • Automatic filtering of:
    • Email addresses
    • Phone numbers
    • Credit card numbers
    • Social Security Numbers (SSN)
    • Custom string patterns (exact match)
  • Configurable rules and replacements
  • Easy CLI, zero config required to start
  • Safe placeholder replacements
  • Cross-platform (Windows, macOS, Linux)

  • Prevents accidental data leaks to ChatGPT, Copilot, Gemini, etc.
  • Enforces company security policies
  • Protects privacy and sensitive business information
  • Lets you use AI tools with peace of mind

  • Developers using LLMs for code review or documentation
  • Security teams enforcing clipboard data policies
  • AI power users handling confidential information
  • Anyone worried about copy-paste data leaks

When you run the application for the first time, a configuration file will be automatically created at ~/.prompt-security/config.json. You can manually edit this file; changes take effect after restarting the program.

About the configuration file:

  • Path: ~/.prompt-security/config.json
  • Automatically created on first run; if corrupted or deleted, it will be restored to default
  • Main configuration logic is in internal/config/config.go
  • Main fields:
{ "detect_emails": true, "detect_phones": true, "detect_credit_cards": true, "detect_ssns": true, "string_match_patterns": [ { "name": "company_name", "pattern": "Acme Corporation", "enabled": true, "replacement": "[COMPANY NAME]" }, { "name": "internal_project", "pattern": "Project Phoenix", "enabled": true, "replacement": "[PROJECT NAME]" } ], "email_replacement": "[email protected]", "phone_replacement": "+1-555-123-4567", "credit_card_replacement": "XXXX-XXXX-XXXX-XXXX", "ssn_replacement": "XXX-XX-XXXX", "monitoring_interval_ms": 500, "notify_on_filter": true }

1. Regular Expression Detection

  • Email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
  • Phone: (\+\d{1,3}[\s-]?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}
  • Credit Card: \b(?:\d{4}[- ]?){3}\d{4}\b
  • SSN: \b\d{3}-\d{2}-\d{4}\b

Configure custom sensitive words, project names, company names, etc. in string_match_patterns:

{ "name": "pattern_name", "pattern": "exact text", "enabled": true, "replacement": "replacement" }

  1. Periodically checks clipboard content
  2. Filters sensitive information using regular expressions and custom rules
  3. Replaces matches with safe placeholders
  4. Automatically writes the filtered content back to the clipboard

This way, any sensitive content you copy will be safely replaced before pasting into LLMs or web pages.


  • Start monitoring:
    ./prompt-security monitor
  • View current configuration:

🔒 Security & Privacy Statement

  • All clipboard content is processed locally; no network connection, no uploads
  • Open source and fully auditable—use with confidence

MIT

Read Entire Article