TraceCloak for Visual Studio Code
IDE-native secret redaction keeping API keys and secrets out of AI coding assistants during "vibe coding," with zero custody of real secret values and zero footprint in release builds.
How It Works
TraceCloak integrates directly into VS Code's Debug Adapter Protocol (DAP) using vscode.debug.registerDebugAdapterTrackerFactory('*', ...):
- DAP Interception: Whenever a debuggee process emits a log via
stdout, stderr, or console, the DAP OutputEvent stream is intercepted in memory before it ever reaches the native VS Code Debug Console panel.
- Instant Redaction: Matches against the canonical rule engine (
@tracecloak/core), Shannon entropy detectors, and exact secrets parsed from workspace environment files.
- In-Place Mutation: Replaces sensitive tokens directly within the protocol message. AI coding assistants (e.g. Cursor, Copilot, Cline, Continue) inspecting the editor or debug logs see only redacted values.
- Zero Code Injection: No packages or dependencies are injected into your user application.
Features
1. 3-State Masking Toggle
- Partial (Default): Preserves key prefixes and suffixes to distinguish between keys during active debugging (
sk_live_example_0000_9fQ2 → sk_live_****9fQ2).
- Full (Shape-Preserving Airtight): Letters and digits are replaced with shape class placeholders while keeping delimiters (
sk_live_example_0000_9fQ2 → aa_aaaa_aaaaaaa_1111_0aA0). Guarantees zero character-level overlap.
- Off: Passes raw console output without redaction.
2. Status Bar Item & Shortcuts
- Status bar indicator on the right:
$(shield) TraceCloak: Partial
- Click the status bar item or press
Ctrl+Alt+S (Cmd+Alt+S on macOS) to instantly cycle modes:
$$\text{Off} \longrightarrow \text{Partial} \longrightarrow \text{Full} \longrightarrow \text{Off}$$
3. Right-Click: "Always Treat Selection as Secret"
- Highlight any sensitive string in the editor, right-click, and select "TraceCloak: Always Treat Selection as Secret".
- Saves the token to your workspace settings (
tracecloak.exactSecrets), instantly redacting it from all debug console streams without modifying any source code files.
4. Real-Time Inline Diagnostics (CWE-798)
- Real-time inline warnings/errors on hardcoded credentials in open source files.
- Two distinct severity tiers:
- Confirmed Pattern Match (Error): High confidence (e.g.
sk_live_, ghp_, AKIA...).
- Entropy-Flagged (Warning): High-entropy random tokens, easily dismissed.
- Supports inline exclusion with
// tracecloak-ignore or # tracecloak-ignore.
When hovering over a detected secret, select the Quick Fix (Ctrl+. or Cmd+.):
- Single Action Chain:
- Replaces hardcoded secret in code with language-appropriate syntax (
process.env.KEY in JS/TS, Platform.environment['KEY'] in Dart).
- Appends
KEY="<secret>" to .env in the workspace root.
- Verifies
.gitignore and automatically appends .env if not already ignored.
- Ingests the new secret into the live redaction engine immediately, keeping console streams clean.
6. Full Git History & Workspace Audit Commands
TraceCloak: Scan Git History for Leaked Secrets: Scans all past commits via git log -p for secrets committed in old revisions (even if deleted in HEAD). Displays full report with commit hashes and authors.
TraceCloak: Scan Workspace Files for Hardcoded Secrets: Runs a static scan across all project files on demand.
7. False-Positive Allowlist
- Quick-fix action "Mark as not a secret (Allowlist false positive)" records the token in workspace settings (
tracecloak.allowlist) and removes the warning immediately.
8. Zero-Config Environment Ingestion & Custom sensitiveKeys
- Automatically scans for
.env, .env.*, local.properties, Info.plist, google-services.json, and GoogleService-Info.plist in the workspace root.
- Watches these files for changes and reloads exact matches into the redaction engine immediately.
- Configure
tracecloak.sensitiveKeys (e.g. ["xyz_key", "mpin"]) to always mask domain-specific keys in logs and AI-safe copies.
9. Copy AI-Safe (Masked for Chat)
- Press
Ctrl+Alt+C (Cmd+Alt+C on macOS) or right-click "TraceCloak: Copy AI-Safe (Masked for Chat)" to copy selected code, logs, or .env snippets with airtight full shape-masking (0% character overlap) — safe to paste into Claude, ChatGPT, Gemini, or Copilot Chat.
10. Visual .env Cloak & Auto AI Guardrails
- Automatically masks secret values in
.env* and local.properties files in the editor during screen-sharing (tracecloak.toggleEnvCloak).
TraceCloak: Sync AI Guardrails updates .cursorignore, .aiignore, .aiexclude, .codeiumignore, .copilotignore, .claudeignore, and .claude/settings.json (Read/Edit/Write permissions.deny rules).
Configuration Settings
tracecloak.mode: Default masking mode ("partial", "full", or "off").
tracecloak.exactSecrets: List of exact strings to treat as secrets.
tracecloak.autoDetectEnvFiles: Automatically ingest secrets from root .env / configuration files (default: true).
Development & Testing
# Build extension
pnpm run build
# Run unit and DAP integration tests
pnpm run test
| |