Skip to content

fix(cli): hide secret env values in --help output#83

Merged
0xMassi merged 1 commit into
mainfrom
fix/cli-hide-env-values
Jul 2, 2026
Merged

fix(cli): hide secret env values in --help output#83
0xMassi merged 1 commit into
mainfrom
fix/cli-hide-env-values

Conversation

@0xMassi

@0xMassi 0xMassi commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Problem

clap renders the current value of an arg's env var in --help by default. For anyone who has the secret set in their environment, webclaw --help prints it in the clear:

--api-key <API_KEY>  [env: WEBCLAW_API_KEY=wc_************************]

Fix

Add hide_env_values = true to every arg backed by a credential-bearing env var. --help now shows the variable name only:

--api-key <API_KEY>  [env: WEBCLAW_API_KEY]

Covered args:

  • CLI (webclaw-cli): WEBCLAW_API_KEY, SERPER_API_KEY, WEBCLAW_PROXY, WEBCLAW_PROXY_FILE, WEBCLAW_WEBHOOK_URL, WEBCLAW_LLM_BASE_URL
  • Server (webclaw-server): WEBCLAW_API_KEY

Verified

  • Builds clean (cargo build -p webclaw-cli -p webclaw-server).
  • cargo fmt --check passes.
  • Ran --help with dummy secret env values set: variable names show, values do not; 0 occurrences of the dummy value in help output.

🤖 Generated with Claude Code

clap prints the current value of an arg's `env` var in --help by default,
which leaks secrets (e.g. `[env: WEBCLAW_API_KEY=wc_...]`) for anyone who
has them set. Add `hide_env_values = true` to every arg backed by a
credential-bearing env var so --help shows the variable name only.

Covers the CLI (WEBCLAW_API_KEY, SERPER_API_KEY, WEBCLAW_PROXY,
WEBCLAW_PROXY_FILE, WEBCLAW_WEBHOOK_URL, WEBCLAW_LLM_BASE_URL) and the
server (WEBCLAW_API_KEY).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@0xMassi
0xMassi merged commit eb8c1c9 into main Jul 2, 2026
4 checks passed
@0xMassi
0xMassi deleted the fix/cli-hide-env-values branch July 2, 2026 13:12
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