pi-crew 0.11.44 → 0.11.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,72 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
3
+ ## [0.11.46] — broker hygiene: token off the child env (stdin handshake) + crew-broker split (2026-10-27)
4
+
5
+ Follow-up wave to the 0.11.45 security hardening: closes the LOW-1 residual (broker token in child env) and pays
6
+ structural debt (crew-broker.ts at 1970/2000 wc-gate) before it blocks further work.
7
+
8
+ **Changed — broker token now travels over spawn stdin, off the child env (LOW-1 closure).** Headless JSON workers
9
+ receive the per-task compound `PI_CREW_BROKER_TOKEN` as a single `buildBrokerStdinLine` v2 payload written to the
10
+ child's stdin right after spawn (heap → pipe → heap — same shape as the F4 background-runner handshake), instead of
11
+ `/proc/<pid>/environ`-visible env. `PI_CREW_BROKER_SOCKET`/`RUN_ID`/`TASK_ID` stay in env (non-secret, needed by the
12
+ worker bootstrap to bind + validate the payload). The worker-side reader (`startChildBrokerClientAsync`) activates
13
+ only when the env token is absent, binds the payload by runId + taskId, cross-checks the socket path, and never
14
+ throws — any mismatch leaves the worker creds-less exactly like today. RPC-mode workers (`--mode rpc` argv guard)
15
+ and surface TUI panes keep the env/launch-script routes untouched. Rollback gate `PI_CREW_BROKER_STDIN=0` restores
16
+ the legacy env route on both sides bit-for-bit. Backward-compat matrix pinned by tests: old-parent→new-worker (env
17
+ route), new-parent→new-worker (stdin), rollback, garbage/wrong-run/socket-mismatch payloads, silent stdin.
18
+
19
+ **Changed — `handleDelegateRequest` extracted from crew-broker.ts (1970 → 1693 lines).** Pure move into
20
+ `src/runtime/broker/crew-broker-delegate-request.ts` via the same deps-object pattern as `protocol/wait-resolve.ts`;
21
+ public `CrewBroker` API unchanged, zero test churn (diff audit: byte-identical modulo `this.`→`deps.` + dedent).
22
+ Re-opens ~300 lines of wc-gate headroom. `scripts/check-lazy-imports.mjs` budget 539 → 540 (new static graph node
23
+ from the split; dynamic import is not an escape — the single-file bundle walks `import()` edges too).
24
+
25
+ ## [0.11.45] — security hardening wave: worktree git-injection class closed + verified review fixes (2026-10-27)
26
+
27
+ ### Security hardening wave — worktree git-injection (MED-1) + verified review fixes
28
+
29
+ Cold-verified adversarial review of v0.11.44 surfaced one CONFIRMED code-exec class finding (git config/hook injection
30
+ in worker-controlled worktrees) plus two same-class bypass vectors found while fixing it. This wave closes the full
31
+ attack surface, not just the original report.
32
+
33
+ **Fixed — git config/hook injection via worker-controlled worktrees (MED-1, CONFIRMED).** Every git invocation that
34
+ runs with `cwd` inside a worktree is now routed through `src/worktree/git-hardening.ts`:
35
+ `-c core.fsmonitor=false -c core.hooksPath= -c core.attributesFile=` (empty `hooksPath` neutralizes
36
+ prepare-commit-msg/post-commit that `--no-verify` does not block), `--no-textconv --no-ext-diff` on `diff`,
37
+ `--no-verify` on `commit`, plus `GIT_CONFIG_NOSYSTEM=1` and a shared `buildGitSafeEnv()` (drops `process.env`
38
+ inheritance and `GIT_CONFIG_SYSTEM`). A gitdir-pointer guard (`verifyWorktreeGitdirPointer` + per-command
39
+ `assertWorktreePointerTrusted`) defeats `.git`-pointer hijack and the R-A3 TOCTOU (pointer flipped mid-chain aborts
40
+ the chain as corrupted). Covers `cleanup.ts`, `worktree-manager.ts` (incl. diff-capture fns R-A1), `post-execution.ts`
41
+ read-lane probe (R-A2 — previously raw git with full env secrets), `branch-freshness.ts`, `goal-achievement.ts`.
42
+ Regression tests use live poisoned-config fixtures (fsmonitor/hooks/textconv/filter.clean/diff.external) and assert
43
+ no marker execution. Residual (documented in-code): filter definitions in genuinely-trusted global config remain
44
+ executable — required for commit identity.
45
+
46
+ **Fixed — broker `stop()` unlink race (R-MINOR-2).** Socket leaf identity (`dev`/`ino`) is pinned right after
47
+ `listen()` in the new `src/runtime/broker/socket-stop.ts`; `stop()` unlinks only while it still owns the inode,
48
+ renames the leaf aside while closing, restores only if the path is still `ENOENT` (B-LOW2), and stale
49
+ `.stopping.<pid>.*` shields are swept once their pid is dead (B-LOW1).
50
+
51
+ **Fixed — kill-timer PID-recycle window (E1).** `killProcessPid` snapshots `/proc/<pid>/stat` starttime at entry and
52
+ re-validates before the 3s SIGKILL (group + absolute-pid fallback); proven mismatch skips the kill with a warn log.
53
+ win32//proc-less platforms keep legacy behavior (documented).
54
+
55
+ **Changed — inference-broker token map keyed by SHA-256 digest (R-LOW-4).** Raw secrets are no longer map keys nor
56
+ retained broker-side after registration, matching `crew-broker-tokens` constant-time discipline.
57
+
58
+ **Changed — pi CLI resolution no longer falls back to `process.cwd()` (E2).** A planted `package.json` matching the
59
+ pi package name could otherwise be spawned as a worker with broker-token env in degenerate installs.
60
+
61
+ **Docs — corrected the R7-9 trust-model comment** in `cross-extension-rpc.ts` (`rpc:run` is the only mutating channel
62
+ accepting unsigned RPCs — rate-limited + cwd-contained; live-control rejects all unsigned ops), and removed the dead
63
+ hello length-check shadowed by `isHelloParams` bounds (crew-broker.ts back under the wc-gate ceiling).
64
+
65
+ **CI — nightly now runs `npm audit --audit-level=high` (signal-only, `continue-on-error`) and `test:coverage`**
66
+ (first workflow to execute the existing coverage script; job timeout 30→45 min).
67
+
68
+ **Tests:** worktree suites 92/92, task-runner 213/213, socket/goal suites 146/146, `test:critical` 125/125,
69
+ `tsc --noEmit` + biome + wc-gate all clean.
4
70
 
5
71
  ## [0.11.44] — fix wave 16: full-backlog burn-down — liveness wiring everywhere + rmSync sweep complete + T-6(b) harden (2026-10-26)
6
72