Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(project-settings): browser-safe absolute check + cap coverage
enes423f01d1d394
diff --git a/src/shared/project-settings.test.ts b/src/shared/project-settings.test.tsindex 83f33513c..9e90faf05 100644--- a/src/shared/project-settings.test.ts+++ b/src/shared/project-settings.test.ts@@ -51,6 +51,46 @@ describe('sanitizeProjectSettingsDoc', () => {})})+describe('sanitizeProjectSettingsDoc field caps (at-cap survives, over-cap drops)', () => {+ it('setupScript/archiveScript: 64000 survives, 64001 drops', () => {+ const atCap = 'a'.repeat(64000)+ const overCap = 'a'.repeat(64001)+ expect(sanitizeProjectSettingsDoc({ setup: { setupScript: atCap } }).setup?.setupScript).toBe(atCap)+ expect(sanitizeProjectSettingsDoc({ setup: { setupScript: overCap } }).setup).toBeUndefined()+ })+ it('launchCmd: 4096 survives, 4097 drops', () => {+ const atCap = 'x'.repeat(4096)+ const overCap = 'x'.repeat(4097)+ expect(sanitizeProjectSettingsDoc({ agents: { launchCmd: atCap } }).agents?.launchCmd).toBe(atCap)+ expect(sanitizeProjectSettingsDoc({ agents: { launchCmd: overCap } }).agents).toBeUndefined()+ })+ it('env value: 4096 survives, 4097 drops the whole entry', () => {+ const atCap = 'v'.repeat(4096)+ const overCap = 'v'.repeat(4097)+ expect(sanitizeProjectSettingsDoc({ agents: { env: { K: atCap } } }).agents?.env).toEqual({ K: atCap })+ expect(sanitizeProjectSettingsDoc({ agents: { env: { K: overCap } } }).agents).toBeUndefined()+ })+ it('env entries: 64 survive, the 65th (key-sorted) is dropped', () => {+ const env: Record<string, string> = {}+ for (let i = 0; i < 65; i++) env[`K${String(i).padStart(2, '0')}`] = String(i)+ const out = sanitizeProjectSettingsDoc({ agents: { env } }).agents?.env ?? {}+ expect(Object.keys(out).length).toBe(64)+ expect(out.K00).toBe('0')+ expect(out.K64).toBeUndefined() // K64 sorts last of the 65 keys, so it is the one dropped+ })+ it('sharedPaths: 128 entries survive, the 129th is dropped', () => {+ const paths = Array.from({ length: 129 }, (_, i) => `p${i}`)+ const out = sanitizeProjectSettingsDoc({ worktree: { sharedPaths: paths } }).worktree?.sharedPaths+ expect(out).toEqual(paths.slice(0, 128))+ })+ it('sharedPaths entry length: 1024 survives, 1025 drops that entry', () => {+ const atCap = 'a'.repeat(1024)+ const overCap = 'b'.repeat(1025)+ const out = sanitizeProjectSettingsDoc({ worktree: { sharedPaths: [atCap, overCap] } }).worktree?.sharedPaths+ expect(out).toEqual([atCap])+ })+})+describe('sanitizeProjectLocalSettings', () => {it('keeps only literal-true known-family ignoreShared flags', () => {const local = sanitizeProjectLocalSettings({diff --git a/src/shared/project-settings.ts b/src/shared/project-settings.tsindex fdd003bf6..05e1fae2f 100644--- a/src/shared/project-settings.ts+++ b/src/shared/project-settings.ts@@ -18,8 +18,6 @@* for node-exec.ts).*/-import * as path from 'path'-export const PROJECT_SETTINGS_FILE = 'settings.json'export type ProjectSettingsFamily = 'setup' | 'worktree' | 'agents' | 'terminal'@@ -160,7 +158,10 @@ function sanitizeSharedPaths(v: unknown): string[] | undefined {for (const entry of v) {if (typeof entry !== 'string') continueif (entry.length === 0 || entry.length > SHARED_PATH_STRING_CAP) continue- if (path.posix.isAbsolute(entry) || WINDOWS_DRIVE_RE.test(entry)) continue+ // `entry.startsWith('/')` stands in for `path.posix.isAbsolute` — src/shared is bundled for the+ // renderer as plain browser code (no Node builtins), and emptiness is already rejected above,+ // so the two are equivalent for every string that reaches this line.+ if (entry.startsWith('/') || WINDOWS_DRIVE_RE.test(entry)) continueif (hasTraversalSegment(entry)) continueif (seen.has(entry)) continueseen.add(entry)