Skip to content

Fix orchestration plan approval bypass and openRepo binding leak#364

Closed
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-detection-6689
Closed

Fix orchestration plan approval bypass and openRepo binding leak#364
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/critical-bug-detection-6689

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 26, 2026

Bug and impact

Orchestration plan approval bypass (security)
The lead agent could spawn full-auto worker/validator sessions without user approval by patching manifest.json directly: replacing /leadState with planApprovedAt, or marking /phases/{id:planning}/status as done. isOrchestrationPlanApproved treated planning phase done as sufficient even without planApprovedAt.

openRepo cancel leaves preload binding null (routing)
project.openRepo cleared currentProjectBinding before IPC but did not restore it when the user cancelled the dialog (null result). Subsequent calls could route to the wrong runtime (main vs remote daemon) until another binding refresh.

claimTask crash on missing manifest
claimTask used runtime.manifest! without a guard when the bundle was missing, causing an unhandled TypeError on IPC.

Root cause

  • LEAD_DENY_PATTERNS blocked only leaf approval paths, not whole-object /leadState replace or planning-phase completion paths.
  • isOrchestrationPlanApproved had a shortcut via phases[].status === "done".
  • openRepo lacked the previousBinding restore pattern already used by switchToPath.

Fix

  • Extend lead deny list; require planApprovedAt while currentPhase === "planning".
  • Restore previousBinding on openRepo null/error.
  • Throw structured run not found from claimTask when manifest is absent.

Validation

  • npx vitest run src/main/services/orchestration/patchPolicy.test.ts
  • npx vitest run src/main/services/ai/tools/orchestrationTools.test.ts -t "spawnAgent|self-approve|planning phase"
  • npx vitest run src/preload/preload.test.ts -t "restores the previous binding when openRepo"

Note: PR #363 (CRR alter leak + failed remote switch binding) is separate and not duplicated here.

Open in Web View Automation 

cursoragent and others added 2 commits May 26, 2026 06:11
Deny lead patches to approval-gated paths (whole leadState, planning
phase completion, planApprovedAt). isOrchestrationPlanApproved now
requires planApprovedAt while still in planning phase instead of
treating planning phase done as sufficient.

Also guard claimTask when the run manifest is missing.

Regression tests in patchPolicy and orchestrationTools.

Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
openRepo nulls the runtime binding before invoking IPC. A cancelled
dialog returned null without restoring the previous binding, so later
calls routed to the wrong runtime until another refresh.

Mirror switchToPath by stashing and restoring previousBinding on null
or error.

Co-authored-by: Arul Sharma <arul28@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored May 26, 2026 6:12am

@arul28
Copy link
Copy Markdown
Owner

arul28 commented May 28, 2026

Closing in favor of #382. I validated the orchestration approval/binding issues here and folded the real fixes into the combined orchestration hardening lane.

@arul28 arul28 closed this May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants