Skip to content

fix(security): scrub credential env vars from ShellExecutor subprocess environment#2452

Merged
bug-ops merged 1 commit intomainfrom
2448-security-hardening
Mar 30, 2026
Merged

fix(security): scrub credential env vars from ShellExecutor subprocess environment#2452
bug-ops merged 1 commit intomainfrom
2448-security-hardening

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 30, 2026

Summary

Note: #2448 was closed as already resolved — crates/zeph-acp/src/transport/auth.rs already uses subtle::ConstantTimeEq on blake3 digests.

Changes

  • crates/zeph-tools/src/config.rs: env_blocklist: Vec<String> field added to ShellConfig with secure defaults
  • crates/zeph-tools/src/shell/mod.rs: env scrubbing loop in execute_bash() before subprocess spawn
  • crates/zeph-tools/src/shell/tests.rs: 5 new tests covering scrubbing, preservation of safe vars, and skill extra_env passthrough

Test plan

  • cargo +nightly fmt --check — pass
  • cargo clippy --all-targets --workspace -- -D warnings — pass
  • cargo nextest run --workspace --lib --bins — 6731 passed, 0 failed
  • New tests: env_blocklist_strips_sensitive_vars, env_blocklist_preserves_safe_vars, env_blocklist_extra_env_still_injected, env_blocklist_multiple_prefixes, empty_env_blocklist_passes_all_vars

@github-actions github-actions bot added bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines) and removed bug Something isn't working labels Mar 30, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 30, 2026 17:22
…s environment (#2449)

Zeph's ShellExecutor inherited the full parent process environment when
spawning bash subcommands, exposing any credentials present in the
process env (e.g. vars set by the user's shell profile) to arbitrary
shell commands executed by the agent.

Add `env_blocklist: Vec<String>` to `ShellConfig` (default-on, covers
ZEPH_*, AWS_*, AZURE_*, GCP_*, GOOGLE_*, OPENAI_*, ANTHROPIC_*, HF_*,
HUGGING*). In `execute_bash`, iterate `std::env::vars()` and call
`cmd.env_remove()` for any key matching a blocklist prefix before
spawning. Skill `extra_env` vars are injected after scrubbing and are
unaffected. Configurable via `[tools.shell] env_blocklist`.

Closes #2449
@bug-ops bug-ops force-pushed the 2448-security-hardening branch from 0762935 to ac9931d Compare March 30, 2026 17:26
@github-actions github-actions bot added the bug Something isn't working label Mar 30, 2026
@bug-ops bug-ops merged commit 06958c2 into main Mar 30, 2026
27 checks passed
@bug-ops bug-ops deleted the 2448-security-hardening branch March 30, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security(tools): scrub credential env vars from ShellExecutor subprocess environment (defense-in-depth)

1 participant