fix(policy): propagate skill trust level to PolicyContext in PolicyGateExecutor#2123
Merged
fix(policy): propagate skill trust level to PolicyContext in PolicyGateExecutor#2123
Conversation
…teExecutor PolicyGateExecutor::set_effective_trust delegated to the inner executor but never updated self.context.trust_level, which was hardcoded to TrustLevel::Trusted at construction time. Trust-level conditions in policy rules were therefore always evaluated against Trusted, making trust_level-based access control non-functional. Fix: update context.trust_level inside set_effective_trust before delegating, using the same RwLock poisoning-safe pattern as the existing update_context() method. Two new unit tests verify end-to-end trust propagation through PolicyGateExecutor: Quarantined context is denied by a Verified threshold allow rule, and Trusted context satisfies it. Closes #2112
aa17f87 to
f65e6bb
Compare
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
PolicyGateExecutor::set_effective_trustdelegated to the inner executor but never updatedself.context.trust_level, which was hardcoded toTrustLevel::Trustedat construction insrc/runner.rs:746trust_level = "verified"etc.) were always evaluated againstTrusted, making trust-level-based access control non-functionalcontext.trust_levelinsideset_effective_trustbefore delegating, using the same RwLock poisoning-safe pattern asupdate_context()Changes
crates/zeph-tools/src/policy_gate.rs:set_effective_trustnow writesleveltoself.context.trust_levelbefore delegating to the inner executorset_effective_trust_quarantined_blocks_verified_threshold_ruleandset_effective_trust_trusted_satisfies_verified_threshold_ruleCHANGELOG.md: added fix entryTest plan
cargo +nightly fmt --checkpassescargo clippy --workspace --features full -- -D warningspasses (0 warnings)cargo nextest run --workspace --features full --lib --binspasses (6368 tests, +2 from baseline)PolicyGateExecutorCloses #2112