Skip to content

fix(security): scope Helm tools, clipboard writes and webhook tokens - #312

Merged
maxthomas95 merged 2 commits into
mainfrom
fix/security-hardening-20261109
Nov 10, 2026
Merged

maxthomas95 merged 2 commits into
mainfrom
fix/security-hardening-20261109

Conversation

@maxthomas95

Copy link
Copy Markdown
Owner

Summary

Review items 5.3 and 5.4 (docs/REVIEW_2026-11-09.md). Four small, independent hardening changes.

  • Helm tools scoped to children. get_session_status and kill_session accepted any session id. They now act only on sessions the calling Helm session spawned. Any other id is reported as not found, the same as an unknown id.
  • Clipboard writes only from the focused pane. OSC 52 writes were honoured for every terminal, including hidden background sessions, so one session could replace what you copied from another. A write is accepted only when the window has focus and the focused element is inside that terminal. The sequence is consumed either way, so nothing reaches the screen. Decoded text over 1,000,000 characters is refused.
  • Webhook token not sent over plain HTTP to a remote host. With a token configured and an http: URL whose host is not loopback, the request is skipped and one warning is logged per origin (no path, query or token). Without a token, plain HTTP works as before. The Vault client's loopback check is shared and now covers 127.0.0.0/8.
  • Stale Helm MCP config files. A crash left <userData>/helm-mcp-configs/<id>.json, which holds a bridge token, on disk. The first Helm setup in a process removes stale ones. Files written later in the same process are not touched.

No new IPC channels and no Settings UI.

Test plan

  • npx tsc --noEmit
  • npx eslint on touched files
  • npx vitest run — 2321 passed; 1 failed, the known Windows-host real-shell test (remote-command.test.ts)
  • Manual: copy from Claude Code over SSH in the focused pane — lands on the local clipboard
  • Manual: a background session that emits OSC 52 does not change the clipboard
  • Manual: a Helm leader can read status of and stop a child it spawned, and gets "Session not found" for another session's id
  • Manual: a webhook with a token and an http:// LAN address stops posting; http://127.0.0.1 and https:// still post

Out of scope

  • Helm spawn_session and autoMode. Gating autoMode would change existing Helm behaviour and is a product decision.
  • Save-time validation of the webhook URL: the notification preferences handler has no validation step today, so the rule is enforced at delivery.
  • The generic CONFIG_SET deny-list and --remote-debugging-port handling.

🤖 Generated with Claude Code

maxthomas95 and others added 2 commits November 9, 2026 20:51
Four small hardening changes from the November review.

- Helm get_session_status and kill_session accepted any session id.
  They now act only on sessions the calling Helm session spawned, and
  report any other id as not found so the tools cannot be used to probe.
- OSC 52 clipboard writes were honoured for every terminal, including
  hidden background sessions, so one session could replace what was
  copied from another. A write is now accepted only when the window has
  focus and the focused element is inside that terminal. The sequence is
  still consumed either way. Decoded text over 1,000,000 characters is
  refused.
- The webhook Bearer token was sent to any http(s) URL. A token is no
  longer sent over plain http to a non-loopback host; the request is
  skipped and one warning is logged per origin, without the path, query
  or token. The Vault client's loopback check is shared and now covers
  all of 127.0.0.0/8.
- A crash left Helm MCP config files, which hold a bridge token, under
  userData. The first Helm setup in a process now removes stale ones.

Helm spawn_session and its autoMode handling are unchanged.

Tests: Helm child scoping for both tools, the focus rule (unit and in
the terminal manager, including a background terminal), webhook token
transport, loopback hosts, stale config cleanup. Full suite: 2321
passed; the one failure is the known Windows-host real-shell test.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@sonarqubecloud

Copy link
Copy Markdown

@maxthomas95
maxthomas95 merged commit afccd4f into main Nov 10, 2026
11 checks passed
@maxthomas95
maxthomas95 deleted the fix/security-hardening-20261109 branch November 10, 2026 03:07
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