Skip to content

Plugin sandbox: let an exact-file write grant cover a repo-root file such as AGENTS.md in a managed run - #9752

Merged
danieljhkim merged 3 commits into
agent-mainfrom
orbit/ORB-25145-0e23595c
Nov 16, 2026
Merged

danieljhkim merged 3 commits into
agent-mainfrom
orbit/ORB-25145-0e23595c

Conversation

@orbit-agent-01

Copy link
Copy Markdown
Contributor

Task

ORB-25145 — Plugin sandbox: let an exact-file write grant cover a repo-root file such as AGENTS.md in a managed run

Description

The constellation standards plugin's standards.sync (built in ORB-25088 to ORB-25091, ws_constellation) re-vendors docs/standards/ and rewrites the managed block in the repository's AGENTS.md. No grant Orbit admits lets it write that one file in a managed run, so every sync task refuses managed_block_not_writable and the drift routine cannot be switched on. Measured with Orbit 0.50.0 (umbrella docs/design/standards-plugin/1_scope.md, Risks):

  • fs.write: ["{{workspace}}"] is refused at orbit plugin validate, because the root contains .git.
  • fs.write_files: ["{{workspace}}/AGENTS.md"] passes validate but:
    • fails orbit plugin test, because the conformance workspace is empty and an exact-file grant refuses a missing file;
    • is refused on the box's checkouts, which are group-writable (umask 0002);
    • is refused when AGENTS.md is an in-repository symlink, which is Orbit's own layout (AGENTS.md → CLAUDE.md).

Goal: a mutating plugin can be granted one named file at the workspace root, and in a managed run that grant reaches the task worktree's file, including a symlink whose target stays inside the worktree. Which of these is the fix is the implementer's call; record it in the plugin design docs:

  • an exact-file grant that accepts a file the conformance run creates and a group-writable file the operator owns;
  • a {{workspace}} grant that excludes .git and .orbit.

The fix must not widen the grant to .git, .orbit or paths outside the worktree, and must not grant a symlink whose target leaves the worktree (STD-05). sandbox: none is not an acceptable answer for a mutating tool.

Acceptance Criteria

  • A plugin whose manifest grants write access to {{workspace}}/AGENTS.md passes orbit plugin validate and orbit plugin test, where the conformance fixture creates that file.
  • Under the real sandbox in a managed run, such a grant lets the backend rewrite the task worktree's AGENTS.md when it is group-writable and when it is a symlink to CLAUDE.md in the same worktree; tests hold both cases.
  • The same grant still refuses writes to .git/, .orbit/, any other root file, and a symlink whose target is outside the worktree; tests hold each refusal.
  • plugins.md in the orbit-setup skill documents the grant and its limits.

Execution Summary

Click to expand

Design choice (recorded in docs/design/plugins/1_scope.md, Exact-file write admission, Workspace root files): extend the exact-file grant rather than add a {{workspace}} directory grant minus .git/.orbit, because the directory form would also open every other root file and anything created at the root later.

Changes:

  • orbit-tools write_file.rs: validate became resolve(path, workspace_root). Accepts a group-writable leaf (still refuses other-write), and group-writable ancestors the user owns (other-writable still needs sticky; non-user group-writable needs sticky). The leaf only may be a symlink when the call has a workspace: link inside it, canonical target a safe regular file inside the same workspace, no .git/.orbit component; the target is what is granted. Links without workspace, to outside, missing, or into metadata are refused.
  • execution.rs: manifest write_files now stored as ManifestWriteFile{requested, granted, workspace_root}; write_files carries the granted physical file. New PluginBackendSpec::rendered_manifest_write_files.
  • sandbox.rs: spawn re-resolves each retained manifest file and refuses if it now resolves to a different file (link swap).
  • conformance runner.rs: creates each fs.write_files entry rendering inside the scratch workspace (not via .., not in .git/.orbit, never over an existing entry) as an empty 0600 file before admission.
  • Managed run: brokered calls already render {{workspace}} to caller.worktree (brokered.rs sandbox_profile(Some(&caller.worktree))), so the grant reaches the task worktree's file; brokered filtering now compares the granted file. No change to orbit-exec boundary.rs (it receives the canonical target, a regular file).
  • Docs: orbit-setup plugins.md (+ synced plugin/skills copy) documents the grant and its limits; design doc updated.

Criteria:

  1. validate + test pass with {{workspace}}/AGENTS.md: PASS — new scenario row a_workspace_exact_file_grant_passes_conformance_on_a_created_file (fails without the runner change, verified by disabling it); manual QA via candidate orbit plugin validate (exit 0) and orbit plugin test (1/1 passed) under a disposable HOME/ORBIT_ROOT.
  2. Real Landlock rewrite of group-writable AGENTS.md and of AGENTS.md -> CLAUDE.md: PASS — a_workspace_agents_md_grant_writes_that_file_only_under_landlock (linux, real run_process).
  3. Refusals: same test asserts writes to .git/config, new .git file, .orbit/config.toml, README.md and ../outside.md fail under the sandbox; a_workspace_agents_md_link_leaving_the_worktree_or_into_metadata_is_refused covers links to an absolute outside file, ../outside.md, .git/config, .orbit/config.toml, .git dir, missing target, link without workspace, and spawn-time retarget. PASS.
  4. plugins.md documents grant and limits: PASS.

Validation:

  • passed: cargo test -p orbit-cli -p orbit-tools (all targets); cargo test -p orbit-cli -p orbit-core --test runtime plugin; scenario table a_config_templated_write_root_outside_scratch_needs_fs_consent_scenarios; make ci-guards; cargo fmt --all -- --check; rustfmt --check --edition 2024 on both changed test files; clippy --lib --bins and --all-targets -D warnings for orbit-tools and orbit-core; cargo doc -D warnings for orbit-tools and orbit-core; scripts/generate-doc-indexes.sh --check; scripts/sync-plugin-skills.sh.
  • not_run: task.final_validation_commands (pipeline final validation); macOS seatbelt run of the new Landlock test (Linux host; the macOS rule is the target's literal path via existing write_files compilation).

Risks/deviations: relaxing group-write is a deliberate widening per the task. Manual QA note: the scratch QA workspace was under .orbit/tmp inside the live checkout, so workspace discovery found the live checkout's .orbit; its one write attempt (catalog refresh) was refused by the read-only sandbox, so nothing was changed there. Backends must rewrite the file in place; rename-replace needs a directory grant (documented).

Reconciliation: 9 modified tracked files, all deliverable; no untracked files outside .orbit/tmp; baseline was clean at 604bec2.

Validation

  • Not reported

Branch Freshness

  • Base ref: refs/remotes/origin/agent-main
  • Head ref: orbit/ORB-25145-0e23595c
  • Behind base: 0
  • Ahead of base: 1

Plugin sandbox: let an exact-file write grant cover a repo-root file such as AGENTS.md in a managed run

Design choice (recorded in docs/design/plugins/1_scope.md, Exact-file write admission, *Workspace root files*): extend the exact-file grant rather than add a `{{workspace}}` directory grant minus .git/.orbit, because the directory form would also open every other root file and anything created at the root later.

Orbit-Task: ORB-25145
@orbit-agent-01 orbit-agent-01 added the orbit orbit related label Nov 16, 2026
orbit[claude-haiku-5-5] and others added 2 commits November 15, 2026 16:53
Manifest verified: attempt rvw-f02c127590df-1, HEAD e5471a0 equals candidate.commit, base cdfa703 is an ancestor of HEAD, and required_validation_commands is present and empty. The implementation meets the four acceptance criteria on this Linux host: the conformance scenario passes with {{workspace}}/AGENTS.md created in the scratch workspace; the Landlock test rewrites a group-writable AGENTS.md and an AGENTS.md -> CLAUDE.md link under the real sandbox; refusals for .git, .orbit, another root file, links leaving the worktree, links into metadata, missing link targets, and spawn-time retargeting are covered; plugins.md documents the grant and its limits. Code review found no correctness defect. Three documentation defects were repaired: a stray task citation and a misjoined paragraph in docs/design/plugins/1_scope.md; a plugins.md statement that Orbit never creates the grant file, which contradicts orbit plugin test creating it, plus an entry rule missing the workspace-link exception (source and synced copy); and the STD-05@‍1 §R7 deviation, which the repository rules require to be recorded in a 4_decisions.md entry, was unrecorded, so docs/design/plugins/4_decisions.md was added. Not run: a macOS Seatbelt run of the link-target grant (no macOS host; the Landlock test is Linux-gated). Observation, not changed: a manifest path spelled under .git that is a symlink to an allowed in-worktree file is granted that file; this follows the physical-path rule (STD-05 §R6) and is recorded in the new decision entry's cost.

Repaired findings: F1, F2, F3.

Changed paths: crates/orbit-core/assets/skills/orbit-setup/references/plugins.md, docs/design/plugins/1_scope.md, docs/design/plugins/4_decisions.md, plugin/skills/orbit-setup/references/plugins.md.

Orbit-Task: ORB-25145
Orbit-Review-Attempt: rvw-f02c127590df-1
Orbit-Review-Crew: haiku@xhigh
Friction F2026-11-327; Daniel authorized the assertion update (session f09993e5, 2026-11-16).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@danieljhkim
danieljhkim merged commit fd90f56 into agent-main Nov 16, 2026
19 checks passed
@danieljhkim
danieljhkim deleted the orbit/ORB-25145-0e23595c branch November 16, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

orbit orbit related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants