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

address review (codex): redact private workspace paths

[._.]/ Adam Eivy1cfcf82af1e2
diff --git a/server/lib/README.md b/server/lib/README.md
index 59895e5efa..e34467904b 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -364,7 +364,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `uuid.js` | `v4()` thin wrapper over `crypto.randomUUID()`. |
| `versionUtils.js` | `compareSemver(a, b)` — semver ordering (-1/0/1) with pre-release precedence and build-metadata stripping. Shared by the self-update checker (`updateChecker.js`) and the local-LLM Ollama update detector (`localLlm.js`). Inputs must be `v`-stripped. |
| `workTracker.js` | `WORK_TRACKERS`/`CONCRETE_WORK_TRACKERS`/`DEFAULT_WORK_TRACKER`, `workTrackerLabel`, `hostToWorkTracker`, `isGithubHost` (GitHub-family host test — github.com + enterprise github.*; enterprise-aware replacement for the github.com-only `isGithub` gate), `githubRepoSpec(origin)` (host-qualified `HOST/OWNER/REPO` selector for `gh --repo`, or null for a non-GitHub origin — pairs the isGithubHost gate with the selector so prWatcher/branchReconcile/issueReconcile share one "resolvable GitHub repo" definition), `forgeCliForTracker`, `isFileTracker` (true when the tracker records work as repo files — PLAN.md — so an agent's proposal necessarily dirties the worktree; false for github/gitlab/jira), `trackerToClaimTaskType`, `hostFromOriginUrl` (subgroup-tolerant host parse), pure `resolveWorkTracker({configured,host})`, async `resolveAppWorkTracker(app)` — resolves a managed app's autonomous work source (PLAN.md / GitHub / GitLab / JIRA), defaulting `'auto'` to the git origin host. Async `resolveRepoForgeTarget(repoPath)` — the ONE definition of "which forge can we query for this checkout", returning `{ forge, fullName, repoSpec, apiHost }` (enterprise-aware `gh --repo` selector for GitHub; `repoSpec: null` for GitLab, which `glab` resolves from its cwd) or null for a non-forge origin; shared by `issueReconcile.js` and `appIssues.js`. Async `resolveAppForgeTarget(app, {repoPath})` — the composed `resolveAppWorkTracker` + `resolveRepoForgeTarget` for callers holding the managed-app record, returning `{ tracker, target }` with the app's github/gitlab pin threaded in as `preferredForge` (so a self-hosted forge on a hostname matching neither pattern still resolves); use this instead of re-threading the pin by hand. Also owns the `{trackerInstructions}` prompt block shared by the TRACKER-FILING task types (types that read the app read-only and deliver findings as tracker items, not a commit): `TRACKER_FILING_PRESETS` (per-task-type slug prefix / label / body requirements — `reference-watch`, `ux`, `repo-study`), `TRACKER_FILING_TASK_TYPES` (derived from the presets, so a gated type always has wording), and `formatTrackerInstructions(tracker, options)` which renders the plan/github/gitlab/jira block (reference-watch is the default option set, so a bare call stays byte-identical for it). Consumed by the `claim-work` router in `cosTaskGenerator.js`, `referenceRepos.js`, and `routes/apps.js`. |
-| `workspaceRoots.js` | Shared allow-list for routes that take a caller-supplied filesystem path. `isWithinAllowedRoots(realPath)` is the single complete test — on Windows it also allows any lettered non-system drive (`D:\code`), which appears in no root, so never render `ALLOWED_WORKSPACE_ROOTS` as "the directories you may use". `outsideAllowedRootsMessage(realPath, { field })` formats a server-only diagnostic with the rejected realpath and every checked root. Also `ALLOWED_WORKSPACE_ROOTS` (defaults + `PORTOS_WORKSPACE_ROOTS`, split on the platform path delimiter — `;` on Windows — and symlink-resolved), `isWithinRoot(resolvedPath, root)` (separator-safe containment), and `WORKSPACE_ROOTS_CONFIGURED` (true when the operator set the env var — lets a permissive-by-default route like `routes/detect.js` opt into confinement). Defaults cover home plus wherever the platform mounts secondary volumes: `/tmp` + `/Users` + `/Volumes` + `/mnt` + `/media` + `/opt` on POSIX; home + the temp dir plus the non-system-drive rule on Windows, where those POSIX literals would resolve to whatever drive the process happens to be on. Used by `routes/commands.js`, `routes/scaffold.js`, and `routes/git.js` (always scoped) and `routes/detect.js` (scoped only when configured). |
+| `workspaceRoots.js` | Shared allow-list for routes that take a caller-supplied filesystem path. `isWithinAllowedRoots(realPath)` is the single complete test — on Windows it also allows any lettered non-system drive (`D:\code`), which appears in no root, so never render `ALLOWED_WORKSPACE_ROOTS` as "the directories you may use". `outsideAllowedRootsMessage(realPath, { field })` formats a redacted server-only diagnostic with the rejected realpath and every checked root. Also `ALLOWED_WORKSPACE_ROOTS` (defaults + `PORTOS_WORKSPACE_ROOTS`, split on the platform path delimiter — `;` on Windows — and symlink-resolved), `isWithinRoot(resolvedPath, root)` (separator-safe containment), and `WORKSPACE_ROOTS_CONFIGURED` (true when the operator set the env var — lets a permissive-by-default route like `routes/detect.js` opt into confinement). Defaults cover home plus wherever the platform mounts secondary volumes: `/tmp` + `/Users` + `/Volumes` + `/mnt` + `/media` + `/opt` on POSIX; home + the temp dir plus the non-system-drive rule on Windows, where those POSIX literals would resolve to whatever drive the process happens to be on. Used by `routes/commands.js`, `routes/scaffold.js`, and `routes/git.js` (always scoped) and `routes/detect.js` (scoped only when configured). |
| `zodCompat.js` | Zod 4 compatibility helpers. `partialWithoutDefaults(objectSchema)` — like `.partial()` but strips inner field defaults first, so a PATCH/update schema doesn't inject (and clobber) the stored values of fields the caller didn't send. Use for any update schema derived from a defaulted base. |
## Test support
diff --git a/server/lib/workspaceRoots.js b/server/lib/workspaceRoots.js
index 666b225df7..4953255041 100644
--- a/server/lib/workspaceRoots.js
+++ b/server/lib/workspaceRoots.js
@@ -83,17 +83,27 @@ export function isWithinAllowedRoots(realPath) {
const HOME_ROOT = ALLOWED_WORKSPACE_ROOTS[0];
-const formatWorkspaceRoot = (root) => root === HOME_ROOT ? '~' : root;
-
const singleLine = (value) => String(value).replace(/[\r\n]+/g, ' ');
+const PRIVATE_HOME_SEGMENT = /(^|[\\/])((?:Users|home))[\\/][^\\/]+(?=([\\/]|$))/gi;
+
+const formatLogPath = (value) => {
+ const path = singleLine(value);
+ if (path === HOME_ROOT) return '~';
+ const relativeHomePath = relative(HOME_ROOT, path);
+ if (relativeHomePath && !relativeHomePath.startsWith('..') && !isAbsolute(relativeHomePath)) {
+ return `~/${relativeHomePath}`;
+ }
+ return path.replace(PRIVATE_HOME_SEGMENT, '$1$2/<user>');
+};
+
/**
- * Build the server-only diagnostic for a path rejected by isWithinAllowedRoots.
+ * Build the redacted, server-only diagnostic for a path rejected by isWithinAllowedRoots.
* Callers keep their existing terse HTTP error so a real filesystem path never
* appears in an API response or a value a user might paste into a public issue.
*/
export function outsideAllowedRootsMessage(realPath, { field = 'path' } = {}) {
- const roots = ALLOWED_WORKSPACE_ROOTS.map(formatWorkspaceRoot);
+ const roots = ALLOWED_WORKSPACE_ROOTS.map(formatLogPath);
if (IS_WINDOWS) roots.push('any non-system drive');
- return `${singleLine(field)} is outside allowed directories: ${singleLine(realPath)} (allowed: ${roots.map(singleLine).join(', ')})`;
+ return `${singleLine(field)} is outside allowed directories: ${formatLogPath(realPath)} (allowed: ${roots.join(', ')})`;
}
diff --git a/server/lib/workspaceRoots.test.js b/server/lib/workspaceRoots.test.js
index 9ce32d9d89..4c4d330bea 100644
--- a/server/lib/workspaceRoots.test.js
+++ b/server/lib/workspaceRoots.test.js
@@ -61,6 +61,13 @@ describe('outsideAllowedRootsMessage', () => {
expect(outsideAllowedRootsMessage('/etc/shadow', { field: 'workspacePath' }))
.toMatch(/^workspacePath is outside allowed directories: \/etc\/shadow \(allowed: .+\)$/);
});
+
+ it('redacts usernames in other home-directory paths', () => {
+ const message = outsideAllowedRootsMessage('/home/alice/private-repo');
+
+ expect(message).toContain('/home/<user>/private-repo');
+ expect(message).not.toContain('alice');
+ });
});
// Windows repos routinely live off the system drive (D:\code, E:\projects), and