Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

security: patch CVEs and eliminate shell-injection vector

[._.]/ Adam Eivy28582f93461d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 491db0dd0a..ae1cd2f455 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -4,12 +4,29 @@
- **Per-stage editorial locks on Pipeline issues.** Each `issue.stages.{id}` now carries a `locked` flag; locked stages refuse regeneration (text generate, image / video enqueue, refine, extract-scenes / extract-pages, audio extract / render, episode-video fresh start, cover-concepts commit). UI exposes a lock toggle on every Pipeline Issue tab and renders a per-stage Lock indicator on the TabPills strip, so users can freeze a finalized comic script while still iterating storyboards.
- **Per-field arc locks on series.** `series.locked.arcFields` is an opt-in sub-map (`{ logline, summary, themes, protagonistArc, shape }`); locked fields are preserved verbatim through `commitSeasonsWithRemap` so arc regenerate + auto-resolve only rewrite the unlocked fields. Inline lock icons on the Arc Canvas read view toggle each field.
+- **Pagination on `GET /api/pipeline/series/:id/issues`.** Accepts optional `?offset=N&limit=N`; when present, returns `{ items, total, offset, limit }`. Without the params, the endpoint still returns the legacy raw array. Eliminates the silent 1000-issue cap for long-running series.
+- **Zod validation across cos-task / loops / cos-job / cos-learning routes.** Replaces manual destructure-and-check with `safeParse` + `failValidation` for consistent 400 errors.
## Changed
- `/claim` slash command now hard-requires an isolated worktree with absolute paths, a single-Bash-invocation flow, and a `pwd` verification checkpoint — eliminates the failure mode where the claim branch was checked out in the main repo and blocked further parallel claims.
- Removed the CLAUDE.md "Worktrees" section that prohibited TUI worktrees; it conflicted with `/claim`'s explicit worktree requirement.
+- **`atomicWrite` migration.** 10 services + 4 aiToolkit modules switched from inline `ensureDir + writeFile + JSON.stringify` to the `atomicWrite` helper (toolkit gets a self-contained copy at `server/lib/aiToolkit/internal/atomicWrite.js`). Prevents partial-write corruption on shared JSON state files.
+- **AI Toolkit runner: PortOS-aware `deleteRun` override.** Now stops the live child process before deleting the run on disk (closes a zombie-process leak when an in-flight CLI run was deleted via the UI).
## Fixed
+- **Shell-injection vector in `agentLifecycle.js:322`.** Replaced `execSync(\`git merge --ff-only origin/${defaultBranch}\`, ...)` with array-arg spawn-based git invocation (`shell: false`).
+- **CVEs in server dependencies.** `basic-ftp` 5.3.0 → 6.0.1 (DoS via malicious FTP server, GHSA-rpmf-866q-6p89); `protobufjs` pinned to 7.5.9 (code injection / prototype pollution); plus transitive `ip-address`, `picomatch`, `postcss` patched via `overrides`.
+- **`agentCliSpawning.js` stream handlers no longer crash the process.** stdout + stderr `async (data)` callbacks now wrap their bodies in try/catch (CLAUDE.md PTY/child-process rule). Stream-json output is batched via `appendAgentOutputLines` instead of per-line state writes.
+- **`toolStateMachine.executions` Map capped at 1000** (previously orphaned on crash because eviction only ran via the success-path 60s timer).
+- **Voice LM Studio fetch calls now use `AbortSignal.timeout(5000)`.** Prevents the voice pipeline from hanging when LM Studio accepts the TCP connection but stops responding mid-model-swap.
+- **`exportByKind('series'|'universe', ids)` now parallelizes exports** via `Promise.all` (was serial `for…of`).
+- **`agentTuiSpawning.js doneSentinelTimer`** no longer silently swallows `readFile` errors; setInterval body wrapped in try/catch.
+- **`server/routes/agents.js`** validates `:pid` as a number before reaching `killProcess`/`getProcessInfo` (`Number.isNaN` guard → 400).
+- **`client/src/components/Layout.jsx`** sidebar refetch failures now log instead of being silently swallowed.
+- **Accessibility:** form labels in `VoiceTab`, `ProviderModelSelector`, `IconPicker`, `ImageGenTab`, `BackupTab`, `MortalLoomTab`, `BackupWidget` now have `htmlFor`/`id` pairing via `useId()`; icon-only buttons in `IconPicker` and `TaskAddForm` use `aria-label`.
+- **`ImageGenTab` parallel-limit number input** no longer snaps to default on every keystroke; draft string state, clamp on blur.
+- **NAV_COMMANDS manifest** registers `/city/settings` and `/ambient` so they are reachable from `⌘K` and voice.
+
## Removed
diff --git a/PLAN.md b/PLAN.md
index 583c1bf3b9..bb2c941b5a 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -183,6 +183,10 @@ God-file decomposition candidates — none are bugs; pick up when touching the f
---
+## Deferred from better/2026-05-19
+
+- [ ] **Client formatter dedupe — signatures differ, skipped.** `client/src/pages/VideoTimelineEditor.jsx:41` defines `formatTime(sec)` (outputs `M:SS.ss` for video timecodes) vs shared `formatTime(timestamp)` (relative time like "5m ago"). `client/src/pages/VideoTimeline.jsx:7` defines `formatDuration(sec)` in seconds; shared alternatives are `formatDurationMs` (ms) and `formatDurationMin` (minutes). `client/src/components/brain/tabs/ImportTab.jsx:56` defines `formatDate` with `month: 'short'` and `'—'` fallback; shared version uses `month: 'long'` and returns `null`. All three need either reconciliation of the shared helper signatures or new named exports (`formatTimecode`, `formatDurationSec`) added to `client/src/utils/formatters.js` before the locals can be removed.
+
## Future Ideas
- **Identity Context Injection** — per-task-type digital twin preamble toggle.
diff --git a/package-lock.json b/package-lock.json
index 5a0c7c353e..bb91383e93 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -237,9 +237,9 @@
"license": "MIT"
},
"node_modules/basic-ftp": {
- "version": "5.3.0",
- "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.0.tgz",
- "integrity": "sha512-5K9eNNn7ywHPsYnFwjKgYH8Hf8B5emh7JKcPaVjjrMJFQQwGpwowEnZNEtHs7DfR7hCZsmaK3VA4HUK0YarT+w==",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-6.0.1.tgz",
+ "integrity": "sha512-3ilxa3n4276wGQp/ImRAuz4ALdsj/2Wd3FqoZBZlajDYnByCZ0JMb4+26Rde0wGXIbM0G2HWSfr/Fi8b21KX8g==",
"dev": true,
"license": "MIT",
"engines": {
@@ -813,13 +813,13 @@
"license": "MIT"
},
"node_modules/picomatch": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
- "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true,
"license": "MIT",
"engines": {
- "node": ">=8.6"
+ "node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
diff --git a/package.json b/package.json
index cb3fa632fa..c5fe75df93 100644
--- a/package.json
+++ b/package.json
@@ -38,9 +38,15 @@
"overrides": {
"path-to-regexp": "8.4.2",
"lodash": "4.18.1",
- "basic-ftp": "5.3.0",
+ "basic-ftp": "6.0.1",
"follow-redirects": "1.16.0",
"brace-expansion": "5.0.5",
- "socket.io-parser": "4.2.6"
+ "socket.io-parser": "4.2.6",
+ "protobufjs": "7.5.9",
+ "@protobufjs/utf8": "1.1.0",
+ "ip-address": "10.2.0",
+ "picomatch": "4.0.4",
+ "postcss": "8.5.15",
+ "systeminformation": "5.31.6"
}
}
diff --git a/server/package.json b/server/package.json
index 34f934bc43..7bb25e4509 100644
--- a/server/package.json
+++ b/server/package.json
@@ -33,9 +33,15 @@
"overrides": {
"path-to-regexp": "8.4.2",
"lodash": "4.18.1",
- "basic-ftp": "5.3.0",
+ "basic-ftp": "6.0.1",
"follow-redirects": "1.16.0",
"brace-expansion": "5.0.5",
- "socket.io-parser": "4.2.6"
+ "socket.io-parser": "4.2.6",
+ "protobufjs": "7.5.9",
+ "@protobufjs/utf8": "1.1.0",
+ "ip-address": "10.2.0",
+ "picomatch": "4.0.4",
+ "postcss": "8.5.15",
+ "systeminformation": "5.31.6"
}
}
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index 1063e43347..633ca155eb 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -8,7 +8,7 @@
import { join, relative, resolve, sep } from 'path';
import { readFile, unlink, rm } from 'fs/promises';
import { existsSync } from 'fs';
-import { execSync } from 'child_process';
+import { execGit } from '../lib/execGit.js';
import { cosEvents, emitLog } from './cosEvents.js';
import { registerAgent, updateAgent, completeAgent, appendAgentOutput } from './cosAgents.js';
import { getConfig, updateTask, addTask, getTaskById, checkStagePrecondition } from './cos.js';
@@ -319,7 +319,7 @@ export async function spawnAgentForTask(task) {
const { baseBranch: defaultBranch } = await git.getRepoBranches(workspacePath).catch(() => ({ baseBranch: null }));
if (defaultBranch) {
await git.checkout(workspacePath, defaultBranch).catch(() => {});
- try { execSync(`git merge --ff-only origin/${defaultBranch}`, { cwd: workspacePath, stdio: 'ignore', windowsHide: true }); } catch (err) { emitLog('warn', `Fast-forward merge of ${defaultBranch} failed: ${err.message}`, { taskId: task.id }); }
+ await execGit(['merge', '--ff-only', `origin/${defaultBranch}`], workspacePath).catch(err => { emitLog('warn', `Fast-forward merge of ${defaultBranch} failed: ${err.message}`, { taskId: task.id }); });
}
}