Skip to content

feat: add experimental Shielded Terminal for API key masking in VS Code#9

Merged
easyvibecoding merged 2 commits intomainfrom
feat/terminal-masking
Mar 21, 2026
Merged

feat: add experimental Shielded Terminal for API key masking in VS Code#9
easyvibecoding merged 2 commits intomainfrom
feat/terminal-masking

Conversation

@easyvibecoding
Copy link
Copy Markdown
Owner

  • 🧪 Experimental: Shielded Terminal (node-pty proxy) masks API
    keys in VS Code terminal output
  • DEC 2026 sync block buffering — buffers complete Claude Code
    Ink renders before masking
  • ANSI + whitespace-aware pattern matching — handles keys
    word-wrapped across visual lines
  • 25 built-in terminal patterns + Core pattern sync
  • Ctrl+Shift+T → opens as editor tab, shield always ON
  • node-pty triple fallback + child_process line-mode backup

Known Limitations

  • Rewind confirmation page may show partial key tail (different
    Ink component wrapping)
  • node-pty required for full PTY features

Test plan

  • npm run build:all + npm run type-check + npm run lint — all pass
  • Manual: Open Shielded Terminal → paste sk-proj-... key
    → fully masked
  • Manual: Run claude in Shielded Terminal → key masked in
    input, response, tab history
  • Manual: Rewind list view → key masked
  • Known: Rewind confirmation detail → partial tail leak

🤖 Generated with Claude Code

easyvibecoding and others added 2 commits March 21, 2026 18:04
Add a Shielded Terminal (Pseudoterminal + node-pty proxy) that masks
API keys in terminal output before rendering. Designed to work with
Claude Code and other CLI tools during demos/livestreams.

Key technical decisions:
- DEC 2026 sync block buffering: Claude Code wraps each Ink render in
  \x1b[?2026h...\x1b[?2026l. Buffer entire sync blocks before masking
  to ensure keys split across PTY chunks are fully assembled.
- ANSI + whitespace stripping for matching: Ink inserts \r\n + indent
  spaces when word-wrapping long keys. Strip ALL whitespace alongside
  ANSI codes for regex matching, preserve structural chars in output.
- node-pty triple fallback: system → VS Code internal (asar) → VS Code
  internal (plain). Falls back to child_process line-mode terminal.

Features:
- 25 built-in terminal patterns (OpenAI, Anthropic, GitHub, AWS, etc.)
- Ctrl+Shift+T or Command Palette → "Open Shielded Terminal"
- "Open Terminal With Command" (default: claude)
- Opens as editor tab (TerminalLocation.Editor)
- Shield always ON by default, syncs with Demo Mode
- Pattern updates from Core via IPC reflected in real-time

Known limitations (marked experimental):
- Rewind confirmation page may show partial key tail
- node-pty required for full PTY features (tab completion, colors)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@easyvibecoding easyvibecoding merged commit 31577ea into main Mar 21, 2026
2 checks passed
@easyvibecoding easyvibecoding deleted the feat/terminal-masking branch March 21, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant