Skip to content

fix(policy): remove env leak and add --trust-level to /policy check#1884

Merged
bug-ops merged 2 commits intomainfrom
1873-policy-check-env-trust
Mar 15, 2026
Merged

fix(policy): remove env leak and add --trust-level to /policy check#1884
bug-ops merged 2 commits intomainfrom
1873-policy-check-env-trust

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

  • Replace std::env::vars().collect() with HashMap::new() in PolicyContext for /policy check — prevents real env vars (API keys, tokens) from leaking into trace output on Telegram and other channels
  • Add optional --trust-level <level> argument to /policy check; parses "trusted" / "verified" / "quarantined" / "blocked", defaults to Trusted for backward compatibility
  • Add FromStr impl for TrustLevel in zeph-tools
  • Extract handle_policy_check() helper to keep handle_policy_command() under the 100-line clippy limit

Fixes #1873

Test plan

  • cargo +nightly fmt --check passes
  • cargo clippy --workspace --features full -- -D warnings passes
  • cargo nextest run --workspace --features full --lib --bins passes (5968 tests)

- Replace std::env::vars().collect() with empty HashMap in PolicyContext
  for /policy check — prevents real env vars (API keys, tokens) from
  appearing in trace output on Telegram and other channels
- Add optional --trust-level <level> argument to /policy check command;
  parses "trusted"/"verified"/"quarantined"/"blocked", defaults to Trusted
- Add FromStr impl for TrustLevel in zeph-tools
- Extract handle_policy_check() to keep handle_policy_command() under
  the 100-line clippy limit

Fixes #1873
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 15, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 15, 2026 22:18
@bug-ops bug-ops merged commit 7d7cee0 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the 1873-policy-check-env-trust branch March 15, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(policy): /policy check leaks env vars in trace and hardcodes TrustLevel::Trusted

1 participant