Skip to content

feat(tools): pre-execution action verification plugin hook in tool pipeline (#1630)#1881

Merged
bug-ops merged 2 commits intomainfrom
research-security-pre-executio
Mar 15, 2026
Merged

feat(tools): pre-execution action verification plugin hook in tool pipeline (#1630)#1881
bug-ops merged 2 commits intomainfrom
research-security-pre-executio

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

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

Summary

Implements the PreExecutionVerifier plugin architecture from the TrustBench pattern (arXiv:2603.09157), extending Zeph's existing security pipeline with pre-execution tool call interception.

  • PreExecutionVerifier trait with VerificationResult (Allow / Block / Warn) stored on ToolOrchestrator
  • DestructiveCommandVerifier: blocks rm -rf /, dd, mkfs, fork bombs, and other destructive shell commands; configurable shell_tools list and allowed_paths; recursive shell wrapper unwrapping (up to 8 levels); NFKC unicode normalization against homoglyph bypasses; lexical path normalization for .. traversal prevention
  • InjectionPatternVerifier: field-aware matching to prevent false positives on query/text/content fields; host-extracted SSRF detection; blocks SQL injection, command injection, path traversal patterns
  • Config: [security.pre_execution_verify] TOML section with per-verifier enable/disable, allowed_paths, shell_tools, extra_patterns
  • CLI: --no-pre-execution-verify escape hatch
  • Metrics: pre_execution_blocks / pre_execution_warnings counters, two new SecurityEventCategory variants
  • TUI: security panel rows for verifier status and block/warn counters
  • 37 unit tests including regression tests for all security fix scenarios

Known limitations (follow-up issues filed)

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --features full -- -D warnings — 0 warnings
  • cargo nextest run --workspace --features full --lib --bins — 5877/5877 passed
  • All 37 new unit tests pass including security bypass regression scenarios

…Bench pattern, #1630)

Add PreExecutionVerifier trait to zeph-tools with two concrete verifiers
integrated into the tool execution pipeline via ToolOrchestrator.

- PreExecutionVerifier trait with VerificationResult (Allow/Block/Warn)
- DestructiveCommandVerifier: blocks rm -rf /, dd, mkfs, fork bombs and
  similar commands; configurable shell_tools list (bash/shell/terminal);
  lexical path normalization for allowed_paths (no canonicalize needed);
  recursive sh -c unwrapping (max 8 levels) with env/exec prefix stripping;
  NFKC unicode normalization against homoglyph bypasses
- InjectionPatternVerifier: field-aware matching (skips query/text/content
  fields to prevent false positives); host-extracted SSRF detection via
  extract_url_host(); blocks SQL injection, command injection, path traversal
- Verifiers stored on ToolOrchestrator (not SecurityState); first Block wins
- Config: [security.pre_execution_verify] TOML section with enabled flag,
  per-verifier enable/disable, allowed_paths, shell_tools, extra_patterns
- CLI: --no-pre-execution-verify escape hatch with audit-level tracing log
- Metrics: pre_execution_blocks + pre_execution_warnings in MetricsSnapshot;
  SecurityEventCategory::PreExecutionBlock/Warn variants
- TUI: security panel shows verifier status and block/warn counters
- 37 unit tests covering all verifier scenarios and security fix regressions
@github-actions github-actions bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate dependencies Dependency updates enhancement New feature or request size/XL Extra large PR (500+ lines) labels Mar 15, 2026
@bug-ops bug-ops enabled auto-merge (squash) March 15, 2026 20:58
@bug-ops bug-ops merged commit 1c09700 into main Mar 15, 2026
20 checks passed
@bug-ops bug-ops deleted the research-security-pre-executio branch March 15, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core zeph-core crate dependencies Dependency updates documentation Improvements or additions to documentation enhancement New feature or request rust Rust code changes size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant