Description
Security audit of PR #3640 found that ErasedToolExecutor::requires_confirmation_erased has a default implementation returning false (line 738 of executor.rs). The speculation engine's try_dispatch uses this method as a gate: if requires_confirmation_erased returns false, the tool is allowed to dispatch speculatively without confirmation.
This is an unsafe-by-default pattern: future executors that opt into is_tool_speculatable_erased (return true) but forget to also implement requires_confirmation_erased will silently bypass the confirmation policy.
Current Risk
Low — no executor currently returns true for is_tool_speculatable_erased for destructive tools. The risk is forward-looking.
Recommended Fix
Option A: Invert the default — requires_confirmation_erased defaults to true, requiring executors to explicitly opt out.
Option B: Add a trait-level contract in the doc comment: implementors that return true for is_tool_speculatable_erased MUST explicitly implement requires_confirmation_erased.
Option A is safer and preferred.
Files
crates/zeph-tools/src/executor.rs — ErasedToolExecutor trait default impl
Depends on
#3636 (merged in PR #3640)
Description
Security audit of PR #3640 found that
ErasedToolExecutor::requires_confirmation_erasedhas a default implementation returningfalse(line 738 ofexecutor.rs). The speculation engine'stry_dispatchuses this method as a gate: ifrequires_confirmation_erasedreturnsfalse, the tool is allowed to dispatch speculatively without confirmation.This is an unsafe-by-default pattern: future executors that opt into
is_tool_speculatable_erased(returntrue) but forget to also implementrequires_confirmation_erasedwill silently bypass the confirmation policy.Current Risk
Low — no executor currently returns
trueforis_tool_speculatable_erasedfor destructive tools. The risk is forward-looking.Recommended Fix
Option A: Invert the default —
requires_confirmation_eraseddefaults totrue, requiring executors to explicitly opt out.Option B: Add a trait-level contract in the doc comment: implementors that return
trueforis_tool_speculatable_erasedMUST explicitly implementrequires_confirmation_erased.Option A is safer and preferred.
Files
crates/zeph-tools/src/executor.rs—ErasedToolExecutortrait default implDepends on
#3636 (merged in PR #3640)