MaskIt - Data Masking Extension for VS Code
Protect sensitive data instantly - mask PII in CSV, JSON, and XML files with customizable rules before sharing or distributing.
Features
- Multiple File Formats: Support for CSV, JSON, and XML files
- Flexible Rules: Define masking rules based on column headers or XML/JSON tags
- Value Pattern Rules: Use regex patterns to mask values regardless of field names
- Multiple Masking Types: Full, partial, hash, or random-based masking
- Wildcard Patterns: Use
* wildcards to match multiple field names
- Field Exclusions: Exclude specific fields from masking (e.g., IDs, timestamps)
- Preview Mode: Preview masked data before applying changes
- Auto-detect Delimiters: Automatically detects CSV delimiters
- Context Menu Support: Right-click access from both editor and file explorer
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "MaskIt"
- Click Install
From Source
- Clone this repository
- Run
npm install
- Run
npm run compile
- Press F5 to launch the extension in debug mode
Quick Start
- Open a data file (CSV, JSON, or XML)
- Run command:
MaskIt: Edit Masking Rules
- Add rules for fields you want to mask
- Run command:
MaskIt: Mask Data in Current File
Commands
- MaskIt: Mask Data in Current File - Apply masking rules to the active file
- MaskIt: Mask Data and Save As... - Mask and save to a new file
- MaskIt: Edit Masking Rules - Add, edit, or remove masking rules
- MaskIt: Preview Masked Data - Preview without modifying the file
Masking Types
| Type |
Description |
Example |
| Full |
Replace all characters |
John Smith → ********** |
| Partial |
Show first/last N characters |
john@email.com → jo***om |
| Hash |
SHA-256 hash (first 8 chars) |
SSN-123 → a3f8b2c1 |
| Random |
Random alphanumeric (preserves structure) |
555-1234 → 382-9471 |
Field Exclusions
Prevent specific fields from being masked, even if they match other rules:
- Case-insensitive:
id matches ID, Id, iD
- Substring matching:
id excludes user_id, customer_id, record_id
- Normalized matching: Ignores underscores, spaces, and dashes
Common Use Cases
- Exclude identifier fields:
id, uuid, key
- Exclude timestamps:
timestamp, created, updated
- Exclude system fields:
version, status, type
To manage exclusions, run MaskIt: Edit Masking Rules and select "Add Excluded Field" or "Remove Excluded Field".
Value Patterns (Regex)
Mask values based on their content using regular expressions, regardless of field names. This is useful for masking data where the field names are inconsistent or unknown.
Example Patterns
| Pattern Name |
Regex |
Matches |
| Email |
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} |
user@example.com |
| SSN |
\d{3}-\d{2}-\d{4} |
123-45-6789 |
| Credit Card |
\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4} |
4111-1111-1111-1111 |
| Phone |
\d{3}[-.)\s]?\d{3}[-.\s]?\d{4} |
555-123-4567 |
How It Works
- Value patterns are checked after field-based rules
- If no field name or pattern rule matches, value patterns are applied
- Any value matching the regex will be masked according to the pattern's settings
- Works across all file types (CSV, JSON, XML)
To add a value pattern, run MaskIt: Edit Masking Rules and select "Add Value Pattern (Regex)".
Documentation
Repository
License
MIT
| |