fix(security): revoke execution-scoped host capabilities - #2264
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | b515a1d | Commit Preview URL Branch Preview URL |
Aug 06 2026, 01:34 AM |
chaliy
force-pushed
the
codex/execution-scoped-capabilities
branch
4 times, most recently
from
August 6, 2026 01:17
4cc7862 to
7bd67c5
Compare
chaliy
force-pushed
the
codex/execution-scoped-capabilities
branch
from
August 6, 2026 01:33
7bd67c5 to
b515a1d
Compare
chaliy
added a commit
that referenced
this pull request
Aug 6, 2026
#2264 moved `ctx.execution_budget()` behind `ExecutionCapability`, and #2265 added bzip2 call sites against the old `Option<&ExecutionBudget>` shape. Each was green against its own base; together they don't compile, so `main` is broken. Decompression meters the budget incrementally as it streams, so it needs the budget itself rather than a consume/lease call. `with_budget` gives it one for the duration of a closure, alongside the existing consume/lease helpers, so the borrow stays inside a checked scope and a revoked execution reports `Cancelled` instead of handing out a live reference. The stdout lease site folds into the `lease_budget_bytes` helper that already existed. Bundled here rather than split out because it blocks this branch's CI.
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.
What changed
Execution extensions, custom and resolved builtin VFS access, host-call brokers, and tool callback request context now share one revocable capability lease per
exec*()call. Completion, timeout, cancellation, or dropped futures revoke retained handles deterministically. Cleanup is bounded and idempotent, with only sanitized status and capped failure counts exposed throughExecResult.Trusted hosts that intentionally need session-lived raw VFS access must opt in explicitly with
BuiltinRegistry::insert_trusted; no compatibility shim preserves implicit unscoped access.Why
Retained extension values, cloned VFS handles, and owned callback context could outlive the execution that authorized them, enabling late or cross-request access to sensitive facilities.
Before / After
Before: a custom builtin could clone
Context.fs, or a callback could retain request context, and keep using it after completion or cancellation.After: positive in-request access succeeds; completion, cancellation, late-use, and cross-request tests return the stable
execution capability revokederror. Cleanup-failure coverage proves poison recovery is bounded, idempotent, and does not expose lock or host internals. Explicit trusted-host registration remains usable across calls.Proof:
just pre-prcargo test -p bashkit --test integration execution_capability_tests(8 passed)cargo test -p bashkit --test integration host_call_execution_tests(7 passed)cargo bench -p bashkit --bench parallel_executioncargo check --workspace --all-targetsjust check-okf && just check-doc-linksRisk
ExecutionCapability::try_with/run; retained handles now fail after request completion by design.ToolArgsrequest-context getters return revocation-aware results.insert_trusted.Checklist