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(speech): reject unknown model ids in delete() — no path traversal via the authed surface (final review)
enes67b2ed868437
diff --git a/src/core/speech/whisper-models.test.ts b/src/core/speech/whisper-models.test.tsindex ecbb16f1e..0700f4bef 100644--- a/src/core/speech/whisper-models.test.ts+++ b/src/core/speech/whisper-models.test.ts@@ -93,6 +93,24 @@ describe('WhisperModelStore', () => {expect(await store.has('tiny')).toBe(true)})+ it('delete() rejects an unknown model id', async () => {+ const store = new WhisperModelStore({ dir, fetchFn: fakeFetch(new Uint8Array(1)) })+ await expect(store.delete('nope')).rejects.toThrow(/unknown/i)+ })++ it('delete() rejects a path-traversal-looking id without touching the fs', async () => {+ const store = new WhisperModelStore({ dir, fetchFn: fakeFetch(new Uint8Array(1)) })+ // Pre-create a file just outside `dir` that a naive `${id}.bin` join could otherwise reach.+ const outside = join(dir, '..', 'traversal-canary.bin')+ writeFileSync(outside, 'do not delete me')+ try {+ await expect(store.delete('../traversal-canary')).rejects.toThrow(/unknown/i)+ expect(existsSync(outside)).toBe(true)+ } finally {+ rmSync(outside, { force: true })+ }+ })+it('delete() removes orphaned .part.<genId> files when nothing is in flight', async () => {const store = new WhisperModelStore({ dir, fetchFn: fakeFetch(new Uint8Array(64)) })// Pre-create the model and an orphandiff --git a/src/core/speech/whisper-models.ts b/src/core/speech/whisper-models.tsindex cbd1f9ca5..97a1f62ac 100644--- a/src/core/speech/whisper-models.ts+++ b/src/core/speech/whisper-models.ts@@ -108,6 +108,11 @@ export class WhisperModelStore {}async delete(id: string): Promise<void> {+ // modelPath() falls back to `${id}.bin` for an unrecognized id — reachable here (and via+ // has()) — so an unvalidated id let the authed delete IPC (register-ipc.ts) rm an arbitrary+ // path under this.dir, e.g. `../../etc/passwd`. Reject up front, same as download() already+ // does via whisperModel().+ if (!whisperModel(id)) throw new Error(`unknown whisper model: ${id}`)const inFlight = this.inFlight.get(id)if (inFlight) {this.inFlight.delete(id)