PasteShield Secret Sanitizer
Công cụ làm sạch bí mật cục bộ có thể đảo ngược, không phụ thuộc vào thành phần nào, và quét rò rỉ trong không gian làm việc; thay thế API key, JWT, URI cơ sở dữ liệu, khóa PEM và IP nội bộ bằng các placeholder <CATEGORY_N> trong RAM trước khi gửi prompt đến LLM trên đám mây, rồi khôi phục câu trả lời chỉ trong 1 lần gọi.
Tài liệu
PasteShield — Reversible AI Prompt & Clipboard Secret Sanitizer
Redact API keys, .env secrets, JWTs, database URIs, cloud connection strings & internal IPs before prompting ChatGPT, Claude, Cursor, or Copilot — and auto-unmask AI code replies in 1 hotkey (Cmd+Alt+V).
VS Code Marketplace → · Open VSX (Cursor / VSCodium) → · Live Playground → · CLI & MCP ↓ · PasteShield Pro ($9) ↓
Why Developers Use PasteShield Instead of ***REDACTED***
Every day, developers paste .env configs, Kubernetes manifests, crash logs, and curl traces into ChatGPT, Claude, DeepSeek, or Cursor. Manually replacing values with ***REDACTED*** breaks two things:
- LLMs lose cross-variable identity (the model cannot tell if two
***strings are the same database host or two different tokens). - Pasting the AI's refactored code back breaks your app until you manually hunt down and re-insert every secret.
PasteShield solves both in <1ms with zero cloud calls:
- Maps each unique secret to a deterministic semantic token (
<OPENAI_KEY_1>,<DB_URI_1>,<GITHUB_TOKEN_1>,<INTERNAL_IP_1>). - Identical secrets across multiple lines or files always map to the exact same placeholder so the LLM preserves variable relationships.
- Restores your exact original secrets in 1 click (
Cmd+Alt+Rin VS Code / Cursor, orpasteshield restorein CLI) when you paste the AI's solution back.
Before & After Roundtrip Example
1. Raw Local Snippet (Stays on Your Machine)
# Production Checkout Service (.env)
OPENAI_API_KEY=sk-proj-EXAMPLE000000000000000000000001
GITHUB_DEPLOY_TOKEN=ghp_EXAMPLE00000000000000000000000001
DATABASE_URL="postgresql://svc_orders:Pr0dP4ss!@10.24.8.15:5432/orders_db"
ONCALL_EMAIL=secops@acme-fintech.example
2. Sanitized Prompt Sent to ChatGPT / Claude / Cursor (Cmd+Alt+C)
# Production Checkout Service (.env)
OPENAI_API_KEY=<OPENAI_KEY_1>
GITHUB_DEPLOY_TOKEN=<GITHUB_TOKEN_1>
DATABASE_URL="<DB_URI_1>"
ONCALL_EMAIL=<EMAIL_1>
3. AI Generates Refactored Code -> 1-Click Local Restore (Cmd+Alt+R)
// AI outputs placeholders -> PasteShield restores real credentials locally in <1ms:
export const checkoutEnv = {
openAiKey: "sk-proj-EXAMPLE000000000000000000000001",
databaseUrl: "postgresql://svc_orders:Pr0dP4ss!@10.24.8.15:5432/orders_db",
deployToken: "ghp_EXAMPLE00000000000000000000000001",
alertEmail: "secops@acme-fintech.example",
};
4 Ways to Use PasteShield
Local MCP Server (Claude Desktop · Cursor · Windsurf · VS Code Copilot)
Run PasteShield as a zero-dependency local stdio MCP Server (sanitize_snippet, restore_snippet, audit_workspace_secrets) with zero npm signup required:
{
"mcpServers": {
"pasteshield": {
"command": "npx",
"args": ["-y", "github:963239327/pasteshield-secret-sanitizer", "--mcp"]
}
}
}
Also installable in 1 click from the Official Visual Studio Marketplace and Verified Open VSX Registry (Cursor / Windsurf / VSCodium).
Option A: VS Code, Cursor, Windsurf & VSCodium Extension
- Install directly from VS Code Marketplace or Open VSX Registry (
verifiedpublishercraftleaf-studio), or downloadpasteshield-ai-secret-sanitizer-1.2.0.vsixfrom GitHub Releases. - In VS Code or Cursor, open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) ->Extensions: Install from VSIX...-> select the.vsixfile (or runcode --install-extension pasteshield-ai-secret-sanitizer-1.2.0.vsix). - Highlight any code/log and press:
Cmd+Alt+C(Ctrl+Alt+C) — Copy Sanitized Selection for AICmd+Alt+V(Ctrl+Alt+V) — Paste & Auto-Unmask AI Reply at CursorCmd+Alt+R(Ctrl+Alt+R) — Restore Original Values from Clipboard / SelectionCmd+Alt+S(Ctrl+Alt+S) — Sanitize Current Editor In-Place- Hover any
<CATEGORY_N>token — View safe masked preview (sk-p••••abcd) from local RAM - Team
.pasteshield.json+ Pre-Commit Gate — Runpasteshield init-policy --install-hookto enforce repo-level redaction rules across your team ($295-Seat Team Policy Pack /$9Solo Pro)
Option B: Instant Zero-Install Browser Playground
Need to scrub a crash log or .env snippet right now without installing anything?
👉 Open Live PasteShield Browser Playground (100% client-side JS, works offline after page load).
Option C: Quickstart CLI & JavaScript SDK (Node.js / Bun, 0 Dependencies)
git clone https://github.com/963239327/pasteshield-secret-sanitizer.git
cd pasteshield-secret-sanitizer
# Run interactive roundtrip demo in your terminal:
node bin/pasteshield-cli.js demo
# Sanitize clipboard on macOS before pasting into ChatGPT / Claude:
pbpaste | node bin/pasteshield-cli.js sanitize --vault .pasteshield-vault.json | pbcopy
# Restore real values into the AI's code reply on your clipboard:
pbpaste | node bin/pasteshield-cli.js restore --vault .pasteshield-vault.json | pbcopy
# Scan workspace or uncommitted `git diff` for accidental secret leaks:
node bin/pasteshield-cli.js scan --git-diff
Use sanitizer-core.js directly as a zero-dependency CommonJS or browser module:
const PasteShieldCore = require('./sanitizer-core');
const vault = PasteShieldCore.createVault();
const { sanitizedText, totalRedactions } = vault.sanitize(process.env.RAW_LOG_SNIPPET || 'OPENAI_API_KEY=sk-proj-1234567890abcdefghijklm');
console.log(sanitizedText); // OPENAI_API_KEY=<OPENAI_KEY_1>
const { restoredText } = vault.restore(`export const key = "${sanitizedText.split('=')[1]}";`);
10 Built-In Secret & PII Detectors (Free Forever)
| Semantic Token | Detected Credentials & Formats |
|---|---|
<OPENAI_KEY_N> | OpenAI (sk-..., sk-proj-..., sk-svcacct-...) & Anthropic (sk-ant-...) LLM keys |
<AWS_ACCESS_KEY_N> | AWS IAM Access Key IDs (AKIA..., ASIA..., ABIA..., ACCA...) |
<GITHUB_TOKEN_N> | GitHub Classic PATs (ghp_), OAuth/App (gho_, ghu_, ghs_, ghr_), Fine-Grained (github_pat_) |
<BEARER_JWT_N> | 3-part signed JWTs (eyJ...) & HTTP Authorization: Bearer <token> headers |
<AZURE_CONN_STR_N> | Azure Storage, Service Bus, Cosmos DB, IoT Hub & Azure SQL connection strings |
<DB_URI_N> | PostgreSQL, MySQL, MariaDB, MongoDB, Redis, AMQP & ClickHouse URIs with embedded credentials |
<PRIVATE_KEY_BLOCK_N> | Multi-line PEM, RSA, EC, OpenSSH & PGP BEGIN ... PRIVATE KEY blocks |
<INTERNAL_IP_N> | RFC1918 (10.x, 172.16-31.x, 192.168.x) & Tailscale/CGNAT (100.64-127.x) private IPv4s |
<EMAIL_N> | Internal & customer email addresses |
<ENV_SECRET_N> | .env / YAML / JSON assignments (*_SECRET, *_PASSWORD, *_TOKEN, *_API_KEY) + Stripe, Slack, Google API, SendGrid, npm & PyPI tokens |
Free vs. PasteShield Pro Comparison
| Feature | Free Community ($0) | PasteShield Pro ($9 One-Time) | Studio All-Access ($19 One-Time) |
|---|---|---|---|
| 10 Built-In Cloud, LLM, DB, JWT & PEM Detectors | ✅ | ✅ | ✅ |
1-Click Reversible Session Vault (Cmd+Alt+C / Cmd+Alt+R) | ✅ | ✅ | ✅ |
| Zero-Dependency Node/Bun CLI & Browser Playground | ✅ | ✅ | ✅ |
| 100% Offline Air-Gapped Execution (Zero Telemetry) | ✅ | ✅ | ✅ |
Custom Corporate Domain Redaction (*.corp.acme.internal -> <COMPANY_DOMAIN_1>) | — | ✅ | ✅ |
| Custom Regex Rules (Jira/Linear IDs, Customer Keys, Proprietary Tokens) | — | ✅ | ✅ |
| Multi-File Sanitized AI Markdown Context Pack Exporter | — | ✅ | ✅ |
Workspace & git diff Markdown Security Audit Report | — | ✅ | ✅ |
| Also Unlocks 4 Sister CraftLeaf Pro Tools (CleanPrint, IDPhoto 4×6, Invoice CRM, CardSheet Duplex) | — | — | ✅ (Gumroad Master Key) |
👉 Get PasteShield Pro ($9 Lifetime Offline Key) · Get Studio All-Access Pass ($19 — Unlocks All 5 Tools)
More Privacy-First Tools by CraftLeaf Studio
All CraftLeaf tools run 100% client-side in your browser or local IDE with zero file uploads:
- 🖨️ CleanPrint & AI-Chat to PDF Extension — Strip clutter & dark backgrounds from ChatGPT/Claude/Docs and export eco low-ink vector PDFs.
- 🪪 Passport & Visa 4×6" ID Photo Sheet Maker — Biometric US/Schengen/UK/Canada/China visa photo cropper tiled onto a
$0.394×6" print sheet. - 🧾 No-Signup Freelancer Invoice PDF Studio — Instant multi-currency client invoices with local CRM memory & payment QR codes.
- 🗂️ CardSheet Duplex Flashcard & PnP Print Studio — Millimeter-accurate front/back duplex offset calibration for flashcards and tabletop cards.
- 🎲 Play Star Chef Showdown Free in Browser — Original 2-player rondel + blackjack-heat Print-and-Play board game with solo AI opponent.
License
MIT © CraftLeaf & Pixel Studio