Skip to content

Audit the full env-var surface from the local binary #17

Description

@jellologic

Finding

The shipping binary at ~/.local/share/claude/versions/2.1.216 (238 MB) contains far more configuration surface than is documented:

Source Count
CLAUDE_CODE_* in binary 418
ANTHROPIC_* in binary 60
Documented in env-vars reference ~50 total

Roughly 90% of the configuration surface is undocumented. Most is internal (test fixtures, telemetry, codenames like CLAUDE_CODE_PEWTER_OWL), but some is directly relevant to third-party launching and worth a systematic pass.

Candidates spotted, none yet investigated:

  • CLAUDE_CODE_DISABLE_NONSTREAMING_FALLBACK — relevant to the ModelScope streaming-auth bug in Expand and verify provider presets #10
  • CLAUDE_CODE_MAX_RETRIES, CLAUDE_CODE_RETRY_WATCHDOG — gateway reliability
  • CLAUDE_CODE_GZIP_REQUEST_BODIES — some gateways mishandle gzip
  • CLAUDE_CODE_EXTRA_BODY, CLAUDE_CODE_EXTRA_METADATA — provider-specific request fields
  • CLAUDE_CODE_DONT_INHERIT_ENV, CLAUDE_CODE_SUBPROCESS_ENV_SCRUB — may interact with our env handling
  • CLAUDE_CODE_USE_GATEWAY, CLAUDE_CODE_API_BASE_URL — possibly distinct from ANTHROPIC_BASE_URL
  • CLAUDE_CODE_NO_MODEL_FALLBACK, CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP

Methodology — use the local binary, not leaked source

This came out of investigating tanbiralam/claude-code. That repo is a mirror of the 2026-03-31 source-map leak: Anthropic shipped v2.1.88 with a .map file exposing unobfuscated TypeScript. It is unlicensed proprietary code and 128 releases stale.

Its staleness is not theoretical. Its src/utils/context.ts lists CLAUDE_CODE_MAX_CONTEXT_TOKENS as an unconditional priority-1 override. In shipping 2.1.216 it is conditional on the model ID not starting with claude- (#15). Anyone citing that repo — or a blog derived from it — gets the wrong model.

Policy for this project:

  • Do not vendor, copy, or derive code from the leak. It's unlicensed proprietary source, and this is a published npm package.
  • Verify configuration surface against the local installed binary, which every user already has, is always current, and is greppable with strings.
  • Record the binary version alongside any finding, since behaviour changes between releases.

A useful secondary reference is marckrenn/claude-code-changelog — tracks current releases, git-tagged per version so behaviour can be diffed across versions. Treat as a lead generator, confirm against the binary.

Explicitly avoid ghuntley/claude-code-source-code-deobfuscation — 986 stars but archived, 16 months stale, and only 103 KB across 37 files. That cannot be Claude Code; it appears to be an AI-generated reimagining, and env vars cited from it should be assumed fabricated.

Acceptance criteria

  • Systematically triage the 418 CLAUDE_CODE_* and 60 ANTHROPIC_* names into: relevant to launching / internal / irrelevant
  • For each relevant one, locate the read site in the binary and record the actual condition
  • Never encode a variable without confirming its read site — presence of a string is not proof it's honored
  • Add a repo script to re-extract on version bumps, so this doesn't silently rot
  • Document the version each finding was verified against

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatThird-party gateway compatibility

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions