Automatically detect, mask, and restore sensitive data (API keys, passwords, emails, URLs, PII) in source code to safeguard codebase privacy and confidentiality.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
🛡️ Code Sanitizer Studio — Visual Studio Code Extension
Detect · Mask · Restore
The official Visual Studio Code extension for Code Sanitizer Studio. Automatically detect, mask, and restore sensitive credentials (API keys, passwords, emails, URLs, PII) in source code files to safeguard codebase privacy and confidential data.
✨ Features
🔍 AST-Powered Engine: Powered directly by @sanitizer/engine via TypeScript AST traversal (ts-morph).
🛡️ Sanitize Active File (ctrl+alt+s / cmd+alt+s): Instantly replace sensitive secrets, credentials, emails, and URLs with reversible placeholders (__SECRET_0001__, __EMAIL_0001__).
🔓 Restore Active File: One-click recovery of original plaintext values from local mapping database.
👁️ In-Memory Diff Preview: Compare Original vs. Sanitized code in VS Code's diff viewer before applying changes — zero temporary files written.
📋 Copy Sanitized Code: Instantly sanitize and copy the output to your clipboard without mutating the current file.
🗂️ Workspace Sanitization: Scan and sanitize your entire project folder with live progress notifications and detailed summary reports.
💡 CodeLens & Diagnostics: Inline action buttons above files and warning highlights on detected secrets.
🔍 Secure Hover Info: Hover over any placeholder (e.g., __SECRET_0003__) to view category details without ever leaking original values.
🌲 Tree View Panel: Group detected findings by category (Secrets, Emails, URLs, Variables) in the Activity Bar.
🔬 Supported Languages & Categories
Supported Languages
TypeScript (.ts, .tsx)
JavaScript (.js, .jsx)
Python (.py)
JSON (.json)
Detection Categories
Category
What is Detected
Placeholder Example
SECRET
API keys, JWT tokens, passwords, .env secrets
__SECRET_0001__
EMAIL
Email addresses in any format
__EMAIL_0001__
PHONE
International and local phone numbers
__PHONE_0001__
URL
HTTP/HTTPS URLs & database connection URIs
__URL_0001__
CITY
Known city and location names
__CITY_0001__
ARABIC_TEXT
Arabic script strings
__ARABIC_TEXT_0001__
MESSAGE
Human-readable log/error messages
__MESSAGE_0001__
VARIABLE
Named import identifiers and implicit assignments
__VARIABLE_0001__
⚙️ Extension Settings
Configure via Settings -> Extensions -> Code Sanitizer Studio:
Setting
Type
Default
Description
sanitizer.autoSave
boolean
true
Automatically save files after sanitizing or restoring.
sanitizer.showPreview
boolean
true
Show an in-memory diff preview before applying changes.
sanitizer.createBackup
boolean
false
Create a .bak backup file before modifying files.
sanitizer.mappingPath
string
""
Custom mapping database path. Defaults to .sanitizer/mapping.sqlite (or mapping.json).