fix(security): harden subplan execution boundary and privilege isolation #8985

Open
opened 2026-04-14 04:35:13 +00:00 by HAL9000 · 1 comment
Owner

Background and Context

v3.3.0 introduces subplan spawning during plan execution, creating a new attack surface where a subplan could potentially escalate privileges, access parent plan resources it should not, or bypass security controls established in the parent plan context. Each subplan must execute within a strict security boundary: it inherits only the permissions explicitly delegated by the parent, cannot access the parent plan's raw context or credentials directly, and cannot modify the parent plan's state outside of the defined merge interface. Without this hardening, a compromised or malformed subplan could undermine the security guarantees of the entire plan execution.

Acceptance Criteria

  • Subplans are spawned with a scoped permission set derived from (not equal to) the parent plan's permissions
  • Subplans cannot directly read or write the parent plan's context, credentials, or decision tree outside of the merge interface
  • Attempting to access out-of-scope parent resources from a subplan raises a SecurityBoundaryViolation error with the resource name in the message
  • The merge interface is the only sanctioned channel for subplan results to flow back to the parent plan
  • Security boundary violations are logged with subplan ID, attempted resource, and timestamp
  • Test coverage >= 97%

Subtasks

  • Define SubplanSecurityContext that holds the scoped permission set for a subplan
  • Update PlanLifecycleService.spawn_subplan() to create a SubplanSecurityContext with only delegated permissions
  • Add boundary enforcement in ToolRuntime to reject tool calls that access out-of-scope resources when running in subplan context
  • Add SecurityBoundaryViolation error type with subplan_id, resource_name, and timestamp fields
  • Ensure subplan results flow back to parent only via the merge interface (block direct state mutation)
  • Add security boundary violation logging to the audit log
  • Add docs/reference/subplan_security.md documenting the isolation model
  • Tests (Behave): Add features/security_subplan_boundary.feature scenarios
  • Tests (Robot): Add robot/security_subplan_boundary.robot integration tests
  • Tests (ASV): Add benchmarks/security_subplan_boundary_bench.py for boundary check overhead
  • Verify coverage >= 97% via nox -s coverage_report; iterate until passing
  • Run nox (all default sessions including benchmark), fix any errors

Definition of Done

  • All acceptance criteria met
  • Tests written and passing (coverage >= 97%)
  • Code reviewed and approved
  • Documentation updated if needed
  • No regressions introduced

Metadata

  • Commit message: fix(security): harden subplan execution boundary and privilege isolation
  • Branch name: fix/security-subplan-boundary

Automated by CleverAgents Bot
Supervisor: Epic Planning Pool | Agent: epic-planning-pool-supervisor

## Background and Context v3.3.0 introduces subplan spawning during plan execution, creating a new attack surface where a subplan could potentially escalate privileges, access parent plan resources it should not, or bypass security controls established in the parent plan context. Each subplan must execute within a strict security boundary: it inherits only the permissions explicitly delegated by the parent, cannot access the parent plan's raw context or credentials directly, and cannot modify the parent plan's state outside of the defined merge interface. Without this hardening, a compromised or malformed subplan could undermine the security guarantees of the entire plan execution. ## Acceptance Criteria - [ ] Subplans are spawned with a scoped permission set derived from (not equal to) the parent plan's permissions - [ ] Subplans cannot directly read or write the parent plan's context, credentials, or decision tree outside of the merge interface - [ ] Attempting to access out-of-scope parent resources from a subplan raises a `SecurityBoundaryViolation` error with the resource name in the message - [ ] The merge interface is the only sanctioned channel for subplan results to flow back to the parent plan - [ ] Security boundary violations are logged with subplan ID, attempted resource, and timestamp - [ ] Test coverage >= 97% ## Subtasks - [ ] Define `SubplanSecurityContext` that holds the scoped permission set for a subplan - [ ] Update `PlanLifecycleService.spawn_subplan()` to create a `SubplanSecurityContext` with only delegated permissions - [ ] Add boundary enforcement in `ToolRuntime` to reject tool calls that access out-of-scope resources when running in subplan context - [ ] Add `SecurityBoundaryViolation` error type with subplan_id, resource_name, and timestamp fields - [ ] Ensure subplan results flow back to parent only via the merge interface (block direct state mutation) - [ ] Add security boundary violation logging to the audit log - [ ] Add `docs/reference/subplan_security.md` documenting the isolation model - [ ] Tests (Behave): Add `features/security_subplan_boundary.feature` scenarios - [ ] Tests (Robot): Add `robot/security_subplan_boundary.robot` integration tests - [ ] Tests (ASV): Add `benchmarks/security_subplan_boundary_bench.py` for boundary check overhead - [ ] Verify coverage >= 97% via `nox -s coverage_report`; iterate until passing - [ ] Run `nox` (all default sessions including benchmark), fix any errors ## Definition of Done - [ ] All acceptance criteria met - [ ] Tests written and passing (coverage >= 97%) - [ ] Code reviewed and approved - [ ] Documentation updated if needed - [ ] No regressions introduced ## Metadata - **Commit message:** `fix(security): harden subplan execution boundary and privilege isolation` - **Branch name:** `fix/security-subplan-boundary` --- **Automated by CleverAgents Bot** Supervisor: Epic Planning Pool | Agent: epic-planning-pool-supervisor
Author
Owner

Verified — Security fix: subplan execution boundary hardening and privilege isolation is required for safe parallel execution. MoSCoW: Must-have. Priority: High — security concern for autonomous execution.


Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor

✅ **Verified** — Security fix: subplan execution boundary hardening and privilege isolation is required for safe parallel execution. MoSCoW: Must-have. Priority: High — security concern for autonomous execution. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
HAL9000 added this to the v3.3.0 milestone 2026-04-14 05:31:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#8985
No description provided.