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(web): restrict webview src + openExternal to http(s) schemes
enesb3787a3b991d
diff --git a/src/renderer/nodes/WebNode.tsx b/src/renderer/nodes/WebNode.tsxindex bf7f9c0f0..b56adc07a 100644--- a/src/renderer/nodes/WebNode.tsx+++ b/src/renderer/nodes/WebNode.tsx@@ -1,6 +1,7 @@import { useEffect, useState } from 'react'import { NodeResizer, useReactFlow, type NodeProps } from '@xyflow/react'import type { CanvasNode } from '../state/workspace'+import { httpUrl } from './webUrl'/*** A web view node. When `data.url` is set it loads that live URL; otherwise it serves the@@ -19,7 +20,12 @@ export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {useEffect(() => {let alive = trueif (url) {- setSrc(url)+ const safe = httpUrl(url)+ if (safe) {+ setSrc(safe)+ } else {+ setError('Unsupported URL scheme — only http/https')+ }} else if (filePath) {window.nodeTerminal.media.allow(filePath)@@ -51,7 +57,10 @@ export default function WebNode({ id, data, selected }: NodeProps<CanvasNode>) {<buttonclassName="term-node__close"title="Open in browser"- onClick={() => window.nodeTerminal.shell.openExternal(url)}+ onClick={() => {+ const safe = httpUrl(url)+ if (safe) window.nodeTerminal.shell.openExternal(safe)+ }}>↗</button>diff --git a/src/renderer/nodes/webUrl.test.ts b/src/renderer/nodes/webUrl.test.tsnew file mode 100644index 000000000..6f2d5a201--- /dev/null+++ b/src/renderer/nodes/webUrl.test.ts@@ -0,0 +1,28 @@+import { describe, it, expect } from 'vitest'+import { httpUrl } from './webUrl'++describe('httpUrl', () => {+ it('passes http URLs (returns normalized string)', () => {+ expect(httpUrl('http://x')).toBe('http://x/')+ })++ it('passes https URLs (returns normalized string)', () => {+ expect(httpUrl('https://x')).toBe('https://x/')+ })++ it('blocks file: scheme', () => {+ expect(httpUrl('file:///etc/passwd')).toBeNull()+ })++ it('blocks javascript: scheme', () => {+ expect(httpUrl('javascript:alert(1)')).toBeNull()+ })++ it('blocks data: scheme', () => {+ expect(httpUrl('data:text/html,x')).toBeNull()+ })++ it('returns null for garbage input', () => {+ expect(httpUrl('not a url')).toBeNull()+ })+})diff --git a/src/renderer/nodes/webUrl.ts b/src/renderer/nodes/webUrl.tsnew file mode 100644index 000000000..0aa061bbe--- /dev/null+++ b/src/renderer/nodes/webUrl.ts@@ -0,0 +1,9 @@+/** Returns the URL string if it is an http(s) URL, else null (blocks file:/javascript:/data:/custom schemes). */+export function httpUrl(raw: string): string | null {+ try {+ const u = new URL(raw)+ return u.protocol === 'http:' || u.protocol === 'https:' ? u.toString() : null+ } catch {+ return null+ }+}