Skip to content

docs(forward-proxy): client trust, release notes, bash/zsh wiring; opt-in shell prefix keeps child processes off the proxy - #385

Open
codeslake wants to merge 8 commits into
cnighswonger:mainfrom
codeslake:ccf/T2135
Open

codeslake wants to merge 8 commits into
cnighswonger:mainfrom
codeslake:ccf/T2135

Conversation

@codeslake

Copy link
Copy Markdown
Contributor

What

Docs fixes for forward-proxy mode, plus one opt-in helper script. Nothing changes for a user who does not opt in. There are no changes to proxy/, to the launcher, to install-service or to any default.

README

  • Client trust behind a TLS-inspecting proxy. A forward-mode client trusts the one file NODE_EXTRA_CA_CERTS names. A 2-line awk 1 … && mv builder puts cache-fix's ca.pem and the corporate root into that file. It is safe when a file lacks a trailing newline, and a mistyped path leaves the old bundle in place. The README now says plainly that nothing in cache-fix builds ca-trust.pem, and it gives a builder for that file too.

  • Which release has what. npm install -g gives 4.3.0. The ca-trust.d section needs 4.4.0-beta.0 (@next).

  • Client wiring. The bash-only reverse-mode "Manual" section is replaced. In its place: a forward-mode claude() function for bash or zsh, and a short CLAUDE_CODE_PROCESS_WRAPPER launcher. Both set NO_PROXY/no_proxy for localhost services and keep the user's own entries; 4.3.0's --remote-control does not merge them. A note explains that a settings.json env block wins over both.

  • Fixes. The example port is now the default 9801, and a machine-specific phrase is removed.

  • Keeping other programs off the proxy. In forward mode, everything Claude Code starts inherits the proxy variables. The new opt-in cache-fix-shell-prefix is a CLAUDE_CODE_SHELL_PREFIX program, so Bash-tool commands, command hooks, stdio MCP servers and the status line run without the six proxy variables. NO_PROXY is left alone, and Claude Code's own traffic keeps the proxy. The section covers:

    • what it does not reach;
    • how to chain an existing prefix (CACHE_FIX_PREV_SHELL_PREFIX);
    • what a missing file looks like;
    • a self-check to re-run after an upgrade;
    • which release ships it, and how to use it on an older install.

    It replaces the earlier claim that these children were harmless because they are blind-tunnelled.

  • Using cswap-pin and cache-fix together. A short block on running both.

bin/shell-prefix.sh (cache-fix-shell-prefix)

A 17-line POSIX sh script. It tells the child kinds apart only by variables Claude Code sets for each kind (CLAUDE_PROJECT_DIR, CLAUDE_PID, SHELL), and it never parses the command string:

  • A Bash-tool command runs in the shell Claude Code chose, after that shell's startup files.
  • Hooks and the status line run under /bin/sh, as they do without a prefix.
  • A stdio MCP server is exec'd directly, so Claude Code's signals still reach it.

Measured on Claude Code 2.1.296 (bash and zsh, Linux) for each of those child kinds:

  • each one carries none of the six variables;
  • exit codes and argv pass through unchanged;
  • a nested claude -p started from Bash still goes through the proxy.

Tests

test/shell-prefix.test.mjs has 16 cases. They cover:

  • each child kind's env shape;
  • a .zshenv or BASH_ENV that re-exports the proxy;
  • sh-only syntax in hooks;
  • exec of a stdio MCP server with argv kept and no wrapper process;
  • the nested MCP case;
  • chaining, including relative, missing and non-executable paths;
  • exit codes.

Nine mutations of the script each fail at least one case. The full suite passes.

codeslake and others added 4 commits October 11, 2026 19:50
…ersion notes

- add a client-trust section: one NODE_EXTRA_CA_CERTS file holding our CA
  plus the corporate root, and a generic ca-trust.pem builder; say that
  nothing in cache-fix builds ca-trust.pem
- mark the ca-trust.d section as needing 4.4.0-beta.0 or newer
- replace the reverse-mode 'Manual (any platform)' snippet with the
  forward-mode shell function and a CLAUDE_CODE_PROCESS_WRAPPER launcher
- default port 9801 in the downloads.claude.ai probe; drop a machine
  reference from the salvage measurement

Co-Authored-By: Claude <noreply@anthropic.com>
…ram that keeps Claude Code's children off the forward proxy

In forward-proxy mode the Bash tool, command hooks, stdio MCP servers and the
status line inherit HTTPS_PROXY and its siblings. bin/shell-prefix.sh unsets the
six proxy variables for them, leaves NO_PROXY alone, and can chain a previous
prefix through CACHE_FIX_PREV_SHELL_PREFIX. Nothing sets the variable for the
user; the README says how.

Co-Authored-By: Claude <noreply@anthropic.com>
…es, settings env for the process wrapper; test: BASH_ENV twin of the .zshenv case

Co-Authored-By: Claude <noreply@anthropic.com>
…for the six proxy variables, awk && mv, rc-export limit for the shell prefix, NO_PROXY in the settings env block

Co-Authored-By: Claude <noreply@anthropic.com>
@codeslake codeslake closed this Oct 12, 2026
@codeslake codeslake reopened this Oct 12, 2026
@codeslake
codeslake marked this pull request as ready for review October 12, 2026 02:15
codeslake and others added 4 commits October 12, 2026 00:11
… cache-fix and not nothing; cache-fix-proxy writes it to cache-fix-state/upstream-<port>

Co-Authored-By: Claude <noreply@anthropic.com>
…d a predecessor's is removed; README to match

Co-Authored-By: Claude <noreply@anthropic.com>
…test spawns, HTTP_PROXY-only hop published, upstream exported quoted, https_proxy fallback

Co-Authored-By: Claude <noreply@anthropic.com>
…ouched; the proxy always writes its sidecar, an empty line when it dials direct

Co-Authored-By: Claude <noreply@anthropic.com>
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