Skip to content

fix+feat: env var detection, computer use interception, Claude Cowork proxy#143

Merged
cyyever merged 3 commits intomainfrom
next3
Mar 27, 2026
Merged

fix+feat: env var detection, computer use interception, Claude Cowork proxy#143
cyyever merged 3 commits intomainfrom
next3

Conversation

@cyyever
Copy link
Copy Markdown
Collaborator

@cyyever cyyever commented Mar 27, 2026

Summary

Three changes: fix fuzz-discovered env var false positive, add computer use tool interception, and auto-proxy Claude Desktop/Cowork on macOS.

1. Platform-aware env var detection

LookupDangerousEnv was unconditionally case-insensitive, blocking eNV= on Unix where it differs from ENV. Now case-sensitive on Unix, case-insensitive on Windows. Uses existing ShellEnvironment().IsWindows(). Removes unused dangerousEnvVarsLower lookup table.

2. Computer use tool interception (Claude + OpenAI)

Claude Computer Use and OpenAI CUA send GUI actions as tool calls. The type action types text into the active app — if the agent types a shell command into a terminal, Crust now intercepts it.

  • extractor_tools.go: new extractComputerTool() — extracts type action text, parses through shell AST pipeline
  • sse_parser.go: handle OpenAI computer_call item type in SSE streaming
  • proxy_toolcalls.go: same for non-streaming OpenAI responses
  • Screenshot, click, scroll, key actions correctly skipped

3. Auto-proxy Claude Desktop/Cowork (macOS)

Claude Desktop (including Cowork) is an Electron app with no proxy config file. On macOS, Crust now sets HTTPS_PROXY/HTTP_PROXY via launchctl setenv when the daemon starts, routing all Claude Desktop API calls through Crust's proxy.

  • builtin_darwin.go: new macOS-only registry target
  • Detects /Applications/Claude.app
  • On stop: launchctl unsetenv restores original state
  • User must relaunch Claude Desktop after crust start

Test plan

  • All pre-commit hooks pass
  • FuzzNormalAgentFalsePositive — 33K executions, zero failures
  • 9 computer use tests (4 blocked type actions + 5 safe actions)
  • All registry tests pass (distinct name check)
  • All env var detection + CVE regression tests pass

LookupDangerousEnv was unconditionally case-insensitive, causing false
positives on Unix where eNV ≠ ENV. Now:
- Windows: case-insensitive (env vars are case-insensitive on Windows)
- Unix: case-sensitive (exact match only)

Uses ShellEnvironment().IsWindows() from the existing platform module.
Removes the unused dangerousEnvVarsLower lookup table.
Parse "type" actions from computer use tool calls through the shell AST
pipeline — catches credential reads, env var poisoning, and reverse
shells typed via GUI automation.

- extractor.go: add "computer" to Layer 1 tool name switch
- extractor_tools.go: extractComputerTool — injects type action text
  into command field for shell AST parsing; skips screenshot/click/scroll
- sse_parser.go: handle OpenAI "computer_call" item type in SSE stream
  (was only handling "function_call")
- proxy_toolcalls.go: same for non-streaming OpenAI responses
- cve_test.go: 9 tests (4 blocked type actions + 5 safe actions)
@cyyever cyyever changed the title fix: platform-aware env var detection (case-sensitive on Unix) fix+feat: platform-aware env vars + computer use tool interception Mar 27, 2026
@cyyever cyyever changed the title fix+feat: platform-aware env vars + computer use tool interception fix+feat: env var detection, computer use interception, Claude Cowork proxy Mar 27, 2026
@cyyever cyyever merged commit ed82e0e into main Mar 27, 2026
16 checks passed
@cyyever cyyever deleted the next3 branch March 27, 2026 04:38
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