fix(tools): propagate claim_source in gate audit and detect relative paths#2539
Merged
fix(tools): propagate claim_source in gate audit and detect relative paths#2539
Conversation
…paths Fixes #2535: AdversarialPolicyGateExecutor.write_audit() now accepts an explicit claim_source parameter. After successful inner execution, claim_source is copied from ToolOutput. Blocked/denied calls pass None. Fixes #2536: extract_paths() now detects relative path tokens without a ./ prefix (e.g. src/main.rs, .local/foo/bar). Added is_relative_path_token() helper that excludes URLs and env assignments.
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
AdversarialPolicyGateExecutor.write_audit()to propagateclaim_sourcefromToolOutputinto audit entries (fix(tools): AdversarialPolicyGateExecutor.write_audit() does not propagate claim_source from ToolOutput #2535)extract_paths()to detect relative path tokens without./prefix, fixing transactional rollback for commands liketouch .local/foo; exit 2(fix(tools): extract_paths misses relative paths without ./ prefix (e.g. foo/bar, .local/...) #2536)Changes
crates/zeph-tools/src/adversarial_gate.rs
write_audit()now accepts explicitclaim_source: Option<ClaimSource>instead of hardcodingNoneout.claim_source.clone()is passed to the audit entryNone(no ToolOutput available)audit_entry_propagates_claim_sourcecrates/zeph-tools/src/shell/mod.rs
extract_paths()extended withis_relative_path_token()helperword/restand.prefix/rest, excluding URLs (://) and env assignments (KEY=value)src/main.rs,.local/foo/bar, URL exclusion, env assignment exclusionTest plan
cargo nextest run -p zeph-tools --lib --bins— 941/941 passedcargo +nightly fmt --check— cleancargo clippy -p zeph-tools -- -D warnings— cleanCloses #2535
Closes #2536