Goal
Prevent top-level basectl invocations from mutating arbitrary directories through an inherited BASE_CLI_RUN_ROOT.
Background
basectl_initialize_run_bundle accepts any non-empty inherited BASE_CLI_RUN_ROOT and returns without checking cache containment or trusted parent-run context. basectl_finalize_run_bundle then replaces run.json, changes permissions, and recursively deletes /tmp.
A focused reproduction pointed BASE_CLI_RUN_ROOT at an unrelated temporary directory and ran a recordable command. The command returned success, overwrote the directory's run metadata, and removed its tmp subtree.
Relevant code:
Scope
- Distinguish trusted nested-command propagation from untrusted top-level inherited state.
- Require reused run roots to resolve beneath the active Base cache owner root.
- Validate the run identifier and any parent-run marker before reuse.
- Scrub or reject invalid inherited run state before command execution.
- Add regression coverage for arbitrary, symlinked, and mismatched run roots.
Acceptance Criteria
- A top-level command cannot overwrite run.json or remove tmp outside the Base cache.
- Legitimate nested commands retain their intended parent/child history behavior.
- Invalid inherited state fails closed or is replaced by a fresh invocation-local bundle.
- Error output does not expose secret environment values.
- Focused tests cover success, command failure, and keep-temp behavior.
Validation
- Focused basectl runtime-dispatch and run-bundle BATS tests.
- A real isolated-cache smoke test for nested commands.
- env -u BASE_HOME ./bin/base-test
- git diff --check
Non-Goals
- Do not remove nested command observability.
- Do not make BASE_CLI_RUN_ROOT a public user configuration surface.
- Do not change normal run bundle layout.
Project Fields
- Status: Ready
- Priority: P1
- Area: Runtime
- Initiative: Contract Hardening
- Size: M
Agent Assignment
Goal
Prevent top-level basectl invocations from mutating arbitrary directories through an inherited BASE_CLI_RUN_ROOT.
Background
basectl_initialize_run_bundle accepts any non-empty inherited BASE_CLI_RUN_ROOT and returns without checking cache containment or trusted parent-run context. basectl_finalize_run_bundle then replaces run.json, changes permissions, and recursively deletes /tmp.
A focused reproduction pointed BASE_CLI_RUN_ROOT at an unrelated temporary directory and ran a recordable command. The command returned success, overwrote the directory's run metadata, and removed its tmp subtree.
Relevant code:
Scope
Acceptance Criteria
Validation
Non-Goals
Project Fields
Agent Assignment