fix(policy): remove env leak and add --trust-level to /policy check#1884
Merged
fix(policy): remove env leak and add --trust-level to /policy check#1884
Conversation
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std::env::vars().collect()withHashMap::new()inPolicyContextfor/policy check— prevents real env vars (API keys, tokens) from leaking into trace output on Telegram and other channels--trust-level <level>argument to/policy check; parses"trusted"/"verified"/"quarantined"/"blocked", defaults toTrustedfor backward compatibilityFromStrimpl forTrustLevelinzeph-toolshandle_policy_check()helper to keephandle_policy_command()under the 100-line clippy limitFixes #1873
Test plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspassescargo nextest run --workspace --features full --lib --binspasses (5968 tests)