fix(tools): write AuditEntry for pre-execution verifier blocks (#2343)#2350
Merged
fix(tools): write AuditEntry for pre-execution verifier blocks (#2343)#2350
Conversation
…ion verifier blocks (#2343) Previously, when a FirewallVerifier (or any PreExecutionVerifier) blocked a tool call in handle_native_tool_calls, the block was logged and metered but never recorded in the audit log. This adds: - Arc<AuditLogger> field on ToolOrchestrator, wired through with_audit_logger() builder method on Agent<C> - Audit write (tokio::spawn fire-and-forget) at the VerificationResult::Block arm in native.rs with error_category=pre_execution_block and error_domain=security - Wiring in agent_setup.rs, runner.rs, daemon.rs, and acp.rs so the same AuditLogger instance is shared between executors and the agent - Test: pre_execution_block_writes_audit_entry verifies the audit file contains a blocked entry after FirewallVerifier rejects a file_path=/etc/passwd call
…es_audit_entry Assert error_domain and duration_ms fields in audit entry to prevent silent regression if field values change.
931a542 to
80971ab
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
AuditEntrywithAuditResult::Blockedto the audit logtool,command(JSON-serialized args),result,error_category="pre_execution_block",error_domain="security",duration_ms=0Arc<AuditLogger>is now wired intoToolOrchestratorvia newAgent::with_audit_logger()builder method; the same logger instance is shared withShellExecutorandWebScrapeExecutorAuditLogger::from_configcalls indaemon.rsandacp.rsby moving logger ownership intoToolSetupRoot Cause
The
AuditResult::Blockedpath existed only inShellExecutor::check_permissions(). FirewallVerifier blocks occur earlier innative.rsbefore any executor is invoked, andAgenthad noArc<AuditLogger>field to write entries from.Test Plan
pre_execution_audit_tests::pre_execution_block_writes_audit_entryverifies that a FirewallVerifier block writes a JSONL entry with correcterror_category,error_domain,duration_ms, and tool nameCloses #2343