Skip to content

fix(tools): propagate claim_source in gate audit and detect relative paths#2539

Merged
bug-ops merged 2 commits intomainfrom
2535-2536-tools-audit-paths
Mar 31, 2026
Merged

fix(tools): propagate claim_source in gate audit and detect relative paths#2539
bug-ops merged 2 commits intomainfrom
2535-2536-tools-audit-paths

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

Changes

crates/zeph-tools/src/adversarial_gate.rs

  • write_audit() now accepts explicit claim_source: Option<ClaimSource> instead of hardcoding None
  • After successful inner execution, out.claim_source.clone() is passed to the audit entry
  • Blocked/denied/error paths still pass None (no ToolOutput available)
  • Added test audit_entry_propagates_claim_source

crates/zeph-tools/src/shell/mod.rs

  • extract_paths() extended with is_relative_path_token() helper
  • Matches tokens of the form word/rest and .prefix/rest, excluding URLs (://) and env assignments (KEY=value)
  • Added 4 unit tests covering src/main.rs, .local/foo/bar, URL exclusion, env assignment exclusion

Test plan

  • cargo nextest run -p zeph-tools --lib --bins — 941/941 passed
  • cargo +nightly fmt --check — clean
  • cargo clippy -p zeph-tools -- -D warnings — clean

Closes #2535
Closes #2536

…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.
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes bug Something isn't working size/M Medium PR (51-200 lines) labels Mar 31, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 31, 2026 17:39
@bug-ops bug-ops merged commit 9108e1e into main Mar 31, 2026
27 checks passed
@bug-ops bug-ops deleted the 2535-2536-tools-audit-paths branch March 31, 2026 17:50
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/M Medium PR (51-200 lines)

Projects

None yet

1 participant