Repository navigation
Accept the managed-worktree identity include and name filesystem faults in the CSO launcher [squash] - #15
Merged
congvc-bot-x99[bot] merged 5 commits intoNov 26, 2026
Conversation
…aults (CHE-9982) - process.ts: accept a plain relative [include] path that resolves to a regular file directly inside the config's own Git directory (no nested includes); bind it in the config identity; everything else still UNSAFE_PATH. - state.ts/cli.ts: mkdir/errno faults report PERSISTENCE_FAILED with the errno instead of INVALID_SCHEMA.
added 4 commits
November 26, 2026 05:44
…orktree (CHE-9982)
… exception (CHE-9982)
…-to-end managed-worktree test (CHE-9982)
…e the caller's value (CHE-9982)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CSO launcher refused every Multica managed worktree with
UNSAFE_PATH, and reported an unwritable state directory asINVALID_SCHEMA. Both left the security review NOT-RUN on three SA004 pull requests. This change accepts the managed-worktree identity include and names filesystem faults correctly.Reproduction (before)
Installed launcher at
1e52e4aff, PRtevo-studio/sa004-vpn#421head2d6abfb50909bfa87634b70c48cc813adaae8fb8.UNSAFE_PATH — managed worktree (
multica repo checkout),gstack-cso-launcher start --repo . --diff --base origin/release/1.0.60 --offline:Cause: Multica writes
<gitdir>/worktrees/<name>/config.worktreecontaining[include] path = multica-identity.config(identity defaults). The guard rejected every[include].INVALID_SCHEMA — same command from a clean clone, with an unwritable
$HOME(env -i HOME=/nonexistent):Cause:
ensureDirectory(lib/cso/state.ts) let a rawEACCESfrommkdirSyncescape; the top-level catch incli.tsrelabels every non-CsoErrorasINVALID_SCHEMA. No field is rejected; the schema is not involved. The launcher output has no run ID, so this is the same string Luna-2 and Sol saw. I could reproduce that exact error text and path; I cannot prove their sandbox had an unwritable state root (they posted no helper report).Fix
lib/cso/process.ts: accept an[include]only if every include directive is a plain[include]section withpath = <plain relative name>, the target resolves (no symlinks, no..) to a regular file directly inside the Git directory that holds the config, and the target includes nothing itself. The target is bounded and identity-checked like the config. Rejected as before:includeIf, subsections, quoting, other keys, absolute or..paths, symlinks, missing files, nested includes, and any file in the working tree (attacker-controlled repo content). This is not a bypass.lib/cso/state.ts: anmkdirfailure isPERSISTENCE_FAILEDwith the errno and aGSTACK_HOMEhint (the launcher passesGSTACK_HOME, notGSTACK_STATE_ROOT).lib/cso/cli.ts:unexpectedFailure()maps errno-coded exceptions toPERSISTENCE_FAILED; unknown exceptions keep the old label.Tests
New:
test/cso-git-hardening.test.ts(managed worktree: accepted; outside,..,~, includeIf, subsection, quoted, keyed, symlink, missing, nested, working-tree: rejected; included file changed mid-operation:SNAPSHOT_RACE; snapshot capture in a managed worktree) andtest/cso-error-mapping.test.ts. The three accept-path tests fail on1e52e4aff; the reject-path tests pass on both (guard not weakened).Wider run (
test/cso-*.test.tsminus docker, integration, windows, macos, registry): 79 failures before and 79 after, identical list (compiled-binary tests; no built core in a fresh checkout). 702 pass. Note: the hostTMPDIRparent (/mnt/ssd2/multica-tmp, mode 775) trips the group-writable-ancestor guard incapturetests; I used a/tmpTMPDIR.Proof on the PR 421 head (fixed launcher built from this branch with
scripts/build-cso.sh)Managed worktree at
2d6abfb:Unwritable
$HOME:Risk
~/.claude/skills/gstack) stays on the old build until setup rebuilds it from this branch after merge.Tracker: CHE-9982, parent incident CHE-9976 (R5).
Round 4 (terra P1 on 72fe7d9): the root is fixed at build time, not taken from the caller
lib/cso/launcher.c:MULTICA_TASK_WORKSPACES_ROOTis no longer forwarded from the caller's environment. The launcher sets it from the compile-timeGSTACK_CSO_MANAGED_ROOT(empty when unset, so every include is rejected: fail closed).scripts/build-cso.sh: passes-DGSTACK_CSO_MANAGED_ROOTfrom the installer'sGSTACK_CSO_MANAGED_ROOT, else itsMULTICA_TASK_WORKSPACES_ROOT. A non-plain or relative path stops the build (exit 64).test/cso-cli.test.ts: compiled-launcher test with three launchers built in the test. (1) Managed worktree under the baked root: accepted, with the caller's variable unset or wrong. (2) Unmanaged linked worktree outside the baked root, caller sets its own parent, the parent of that, or/:UNSAFE_PATH. (3) Launcher built without a root: both worktrees rejected even when the caller names the managed root. It fails on the old launcher source.(A shell with
umask 0002or a group-writableTMPDIRparent trips "group- or world-writable ancestor" in the fixtures; unrelated to this change.)AC 4 on this head: launcher built with
GSTACK_CSO_MANAGED_ROOT=/mnt/ssd2/multica_workspaces bash scripts/build-cso.sh, run from the author worktree on the PR 421 head2d6abfb:start --offlinereturns runId1795682806860-4ccb1408d346ffb0, statusrunning.MULTICA_TASK_WORKSPACES_ROOT=/nonexistent: runId1795682888594-35c13493bfdc3310, statusrunning./tmp, caller envMULTICA_TASK_WORKSPACES_ROOT=/tmp:UNSAFE_PATH.Setup must build the launcher with the root (it inherits the daemon's
MULTICA_TASK_WORKSPACES_ROOT); a launcher built without it rejects managed includes.AC 1-2 evidence: original INVALID_SCHEMA, Sol's exact invocation in the Codex sandbox (head 49f88b6, no code change)
Run on X99, 26 Nov 2026, codex-cli 0.166.0. Source: CHE-9982 comment 01a217c1 (the issue's coordinating agent ran these; I repeated the tiny-repo variant of step 1 and 3 earlier and got the same result).
Setup: fresh clone of
tevo-studio/sa004-vpn, detached at Sol's signed head2d6abfb5; localrelease/1.0.60at Sol's basea59cb1d9(the remote branch is gone, both commits fetched by SHA). No repo Git config include, so this is not theUNSAFE_PATHcase. Command from Sol's report, only the path differs:gstack-cso-launcher start --repo <clone> --diff --base release/1.0.60workspace-write: exit 1, no run ID, byte-identical to Sol's output.status: running,completeness: partial). The input and repo are valid; only the sandbox changes the result.49f88b6ewithscripts/build-cso.sh), same args, sandbox: exit 1,PERSISTENCE_FAILED, "The helper hit a filesystem error (EROFS)". EROFS is the failing operation: the state-root write on a read-only file system. In that sandboxtouch ~/.gstack/probegivesRead-only file system.Result: same input, same sandbox, same message as Sol.
INVALID_SCHEMAis a catch-all, so the text alone proves nothing. The new build names the operation (EROFS) on the identical call. No schema field is rejected. The producer was the catch-all incli.tsrelabelling a raw filesystem fault fromensureDirectory; this head maps it toPERSISTENCE_FAILEDwith aGSTACK_HOMEhint.Limits: I cannot replay Sol's own session (strace is blocked in the sandbox). Luna-2's command was not recorded beyond "INVALID_SCHEMA three times"; Luna-2 is also a Codex agent under the same sandbox.
Not claimed: after this fix a Codex sandbox agent still cannot run the launcher, because its state root must be writable and private. That is CHE-10265, a separate fix.