Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

fix(security): fail-closed dispatch for isolated consume final/consume execution - #696

Open
pomazanbohdan wants to merge 1 commit into
mainfrom
codex/-,-vida
Open

pomazanbohdan wants to merge 1 commit into
mainfrom
codex/-,-vida

Conversation

@pomazanbohdan

Copy link
Copy Markdown
Owner

Motivation

  • A recent change allowed an exception that let vida taskflow consume final bypass the dispatch-disabled guard when an external (isolated) VIDA_STATE_DIR was supplied and the current working directory resolved as a project, which could lead to executing a project-configured backend despite taskflow.dispatch.enabled: false.
  • The intent of this patch is to restore the original fail‑closed policy so isolated state roots cannot cause execution or spawn external commands.

Description

  • Removed the special-case exception that suppressed the disabled-dispatch return for isolated state roots and replaced it with a single pure predicate consume_dispatch_is_disabled(subcommand, dispatch_enabled) that enforces fail-closed semantics for execution-capable subcommands (final, continue, advance).
  • The early guard now returns the dispatch_runtime_disabled payload before any state mutation, packet write, or dispatch execution when dispatch is not enabled for the selected state root.
  • Added a unit regression test asserting that execution-capable consume subcommands are blocked when dispatch is disabled and allowed when enabled.
  • Changes are localized to crates/vida/src/taskflow_consume.rs (predicate + guard + test) and do not alter other runtime execution paths.

Testing

  • Ran rustfmt --edition 2021 --check crates/vida/src/taskflow_consume.rs and formatting check passed for the modified file. (Passed)
  • Ran focused tests with cargo test -p vida --bin vida execution_capable_consume_subcommands_fail_closed_when_dispatch_is_disabled -- --nocapture and cargo test -p vida --bin vida dispatch_defaults_to_management_only_and_requires_boolean_true -- --nocapture, both tests passed. (Passed)
  • Performed cargo check -p vida --bin vida and git diff --check to validate compilation and diff hygiene; these checks succeeded though unrelated compiler warnings exist in other crates. (Passed with unrelated warnings)
  • The change is intentionally scoped and covered by the added regression test to prevent reintroducing the bypass in the consume final path.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 909f9fc5a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

&& !dispatch_enabled
&& !allow_external_state_final_blocked_payload
{
if consume_dispatch_is_disabled(consume_subcommand, dispatch_enabled) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve read-only consume-final modes when dispatch is disabled

When VIDA_STATE_DIR points to an isolated state root, taskflow_dispatch_enabled_for_state_root always returns false, so this guard now rejects consume final --preview and --validate-only before their arguments are parsed. Those modes are explicitly read-only and skip packet writes, receipt persistence, and dispatch execution, and the removed exception previously allowed them in this exact isolated-root scenario. Restrict the disabled-dispatch guard to execute mode so operators can still inspect and validate a handoff without enabling execution.

Useful? React with 👍 / 👎.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant