This minimal extension intercepts the editor paste action and scans clipboard text for sensitive patterns (emails, Aadhaar, PAN, credit-cards, AWS keys, high-entropy secrets, and image data-URLs). If sensitive data is detected, it prompts the user to redact, paste anyway, or block the paste.
Quick test (development host):
- Open this workspace folder (
vs_code) in VS Code. - Press
F5to launch an Extension Development Host. - In the extension host window, open or create a file, copy some text that contains an email or number, and press
Ctrl+V/Cmd+V. - You should see a modal that lets you
Redact & Paste,Paste Anyway, orBlock Paste.
Limitations:
- VS Code API exposes only textual clipboard access (
env.clipboard.readText()); binary clipboard/image access is not available. The extension detects commondata:image/...;base64,payloads in textual clipboard contents but cannot access raw image clipboard bytes. - This is a conservative, client-side helper. It cannot prevent other programs from sending data outside VS Code.
If you'd like, I can:
- Add configuration options (fail-closed vs warn-only).
- Extend live document-change scanning to detect pasted content that bypasses the command.