Skip to content

fix(core): fix SpeculationEngine sweeper abort and requires_confirmation default#3647

Merged
bug-ops merged 1 commit intomainfrom
3644-speculation-security
May 6, 2026
Merged

fix(core): fix SpeculationEngine sweeper abort and requires_confirmation default#3647
bug-ops merged 1 commit intomainfrom
3644-speculation-security

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented May 6, 2026

Summary

Test plan

  • cargo +nightly fmt --check — clean
  • cargo clippy --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler" -- -D warnings — clean
  • cargo nextest run --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 9138 passed, 0 failed
  • Security audit by rust-security-maintenance — both fixes approved
  • Code review approved

…ion default

Fixes two bugs found in the security audit of PR #3640:

1. ErasedToolExecutor::requires_confirmation_erased defaulted to false,
   allowing speculative dispatch without confirmation for any future executor
   that opts into is_tool_speculatable_erased but forgets to override the gate.
   Inverted the default to true (safe-by-default). Added requires_confirmation
   to ToolExecutor (default false) with a blanket impl delegation.
   TrustGateExecutor overrides requires_confirmation to mirror check_trust.
   All existing direct ErasedToolExecutor impls updated to explicitly return false.

2. SpeculationEngine::new (supervisor=None branch) used mem::forget on the
   sweeper JoinHandle and immediately dropped the AbortHandle, leaking the
   tokio task until runtime shutdown. Replaced the dummy TaskHandle approach
   with a SweepHandle enum (Supervised(TaskHandle) | Raw(JoinHandle<()>))
   that calls abort(self) in Drop.

Closes #3644, Closes #3645
@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate labels May 6, 2026
@bug-ops bug-ops enabled auto-merge (squash) May 6, 2026 10:47
@github-actions github-actions Bot added bug Something isn't working size/L Large PR (201-500 lines) labels May 6, 2026
@bug-ops bug-ops merged commit bfce23b into main May 6, 2026
32 checks passed
@bug-ops bug-ops deleted the 3644-speculation-security branch May 6, 2026 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

1 participant