an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
feat(release): the drop carries no buttons, and its own links work
Chaitanya Girib971dbb1ae82
diff --git a/src/main/index.ts b/src/main/index.tsindex 60534716..fb7e9d54 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -2256,8 +2256,14 @@ function createWindow(opts: { floor?: boolean } = {}): BrowserWindow {win.once('ready-to-show', () => win.show());+ // Never opens a window; hands the URL to the OS browser instead.+ //+ // Scheme-checked, because this is now reachable from AUTHOR-CONTROLLED markup:+ // a release drop's iframe has `allow-popups`, so a target="_blank" link in a+ // release body arrives here. http(s) only — an unguarded openExternal will+ // happily launch file://, or a registered custom scheme, on the user's machine.win.webContents.setWindowOpenHandler(({ url }) => {- shell.openExternal(url);+ if (/^https?:\/\//i.test(url)) shell.openExternal(url);return { action: 'deny' };});diff --git a/src/renderer/src/components/QuitWarningModal.tsx b/src/renderer/src/components/QuitWarningModal.tsxindex b8ddbb8e..c6b5a170 100644--- a/src/renderer/src/components/QuitWarningModal.tsx+++ b/src/renderer/src/components/QuitWarningModal.tsx@@ -41,7 +41,13 @@ export function QuitWarningModal({ ptyCount, closing, onCancel, onConfirm, onCloposition: 'fixed', inset: 0,background: 'rgba(26, 19, 32, 0.7)',display: 'flex', alignItems: 'center', justifyContent: 'center',- zIndex: 300+ // Above EVERY modal, not just most of them. Modals in this app sit at+ // 500 (add agent, edit agent, the release drop) and overlays below that.+ // At 300 this dialog opened BEHIND the release drop, so clicking quit+ // with a drop on screen looked like quit did nothing — while a hidden+ // dialog held the app open. This is the last thing the user is asked+ // before the process dies; it outranks whatever it interrupts.+ zIndex: 1000}}><divdiff --git a/src/renderer/src/components/ReleaseDrop.tsx b/src/renderer/src/components/ReleaseDrop.tsxindex 7080b278..deef3722 100644--- a/src/renderer/src/components/ReleaseDrop.tsx+++ b/src/renderer/src/components/ReleaseDrop.tsx@@ -3,21 +3,29 @@** A corner toast with three clipped bullets is a changelog notification. This is* the other thing: a page the release author designs, shown once, at the size the- * work deserves. The chrome here is deliberately thin — a header, a frame, a- * footer of actions — because everything that should carry personality lives- * inside the authored HTML, and the app's job is to present it and get out of- * the way.+ * work deserves.*- * The authored HTML runs in an iframe with `sandbox=""` and a `default-src 'none'`- * CSP (see shared/releaseDrop.ts for why that is not negotiable). Two consequences- * shape this component:+ * There is NO chrome button here, on purpose. The app frames the drop and gets+ * out of the way; every action the release wants to offer — read the notes, star+ * the repo, join the Discord — is authored INSIDE the HTML as an ordinary link,+ * where the person writing the release controls the wording and the placement.*- * 1. Links inside the drop cannot navigate — no scripts, no popups. So every- * real action (read the release, star, dismiss, restart) is a chrome button- * OUT here, where it is ordinary app code with ordinary permissions.- * 2. The frame's height cannot be measured (that needs a postMessage bridge,- * which needs allow-scripts). So the modal is a fixed viewport-relative box- * and the drop scrolls inside it, rather than the box growing to fit.+ * The authored HTML runs in an iframe with a `default-src 'none'` CSP and a+ * sandbox that grants exactly one capability: `allow-popups` (see+ * shared/releaseDrop.ts for why everything else stays shut). That is what makes+ * an authored `<a target="_blank">` work — the frame cannot navigate anything+ * itself, it can only ASK for a window, and main's setWindowOpenHandler denies+ * the window and hands the URL to the OS browser if and only if it is http(s).+ * No scripts, no same-origin, no forms, no top-level navigation.+ *+ * One consequence still shapes the layout: the frame's height cannot be measured+ * (that needs a postMessage bridge, which needs allow-scripts). So the modal is a+ * fixed viewport-relative box and the drop scrolls inside it, rather than the box+ * growing to fit.+ *+ * Dismissal is Esc or a click on the backdrop. Both were always here; with the+ * close button gone the header says so in words, because a modal this large with+ * no visible way out is a trap.*/import { useEffect, useMemo } from 'react';import { buildDropSrcDoc } from '../../../shared/releaseDrop';@@ -26,20 +34,10 @@ export interface ReleaseDropProps {version: string;/** Authored HTML, already extracted from the release body. */html: string;- /** 'downloaded' offers a restart; 'available-manual' offers the releases page. */- canRestart: boolean;- busy: boolean;- showStar: boolean;- onRestart: () => void;- onOpenRelease: () => void;- onStar: () => void;onDismiss: () => void;}-export function ReleaseDrop({- version, html, canRestart, busy, showStar,- onRestart, onOpenRelease, onStar, onDismiss-}: ReleaseDropProps) {+export function ReleaseDrop({ version, html, onDismiss }: ReleaseDropProps) {const srcDoc = useMemo(() => buildDropSrcDoc(html), [html]);// Esc dismisses. A modal this large with no keyboard exit feels like a trap,@@ -53,19 +51,8 @@ export function ReleaseDrop({// The chrome deliberately drops the app's pixel idiom. Inside this dialog the// drop is the subject and the surrounding UI should read as a quiet frame// around it — sharp 2px borders and hard drop-shadows fight a modern page.- const INK = '#14131A';const INK_SOFT = '#6C6875';const LINE = 'rgba(20,19,26,0.10)';- const button = (primary: boolean): React.CSSProperties => ({- padding: '9px 18px',- borderRadius: 999,- background: primary ? INK : 'transparent',- color: primary ? '#FBFAF8' : INK_SOFT,- border: primary ? '1px solid ' + INK : `1px solid ${LINE}`,- fontFamily: 'inherit', fontSize: 13.5, fontWeight: primary ? 600 : 500,- cursor: busy ? 'not-allowed' : 'pointer',- opacity: busy && primary ? 0.6 : 1- });return (<div@@ -102,70 +89,39 @@ export function ReleaseDrop({boxShadow: '0 24px 70px rgba(20,19,26,0.34), 0 2px 8px rgba(20,19,26,0.18)',// The app's own UI font is part of its pixel identity and reads as// retro chrome wrapped around a modern page. The dialog uses the system- // stack instead, matching the drop inside it — one typographic voice- // from the title bar to the buttons.+ // stack instead, matching the drop inside it — one typographic voice.fontFamily: '-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif'}}>- {/* Header — a thin, quiet bar. The drop supplies its own title. */}+ {/* Header — a thin, quiet bar. The drop supplies its own title, and the+ only thing out here is a label plus how to leave. Both are inert+ text: the whole point of this dialog is that it holds no controls. */}<div style={{flexShrink: 0, display: 'flex', alignItems: 'center', gap: 10,padding: '14px 18px 12px', borderBottom: `1px solid ${LINE}`,- background: '#FBFAF8'+ background: '#FBFAF8',+ fontSize: 11.5, fontWeight: 600, letterSpacing: '.1em',+ textTransform: 'uppercase', color: INK_SOFT}}>- <span style={{- fontSize: 11.5, fontWeight: 600, letterSpacing: '.1em',- textTransform: 'uppercase', color: INK_SOFT, flex: 1, minWidth: 0- }}>- Munder Difflin · {version}+ <span style={{ flex: 1, minWidth: 0 }}>Munder Difflin · {version}</span>+ <span aria-hidden style={{ flexShrink: 0, opacity: 0.75, letterSpacing: '.08em' }}>+ Esc to close</span>- <button- onClick={onDismiss}- aria-label="Close"- style={{- width: 28, height: 28, borderRadius: 999, flexShrink: 0,- border: `1px solid ${LINE}`, background: 'transparent', cursor: 'pointer',- fontFamily: 'inherit', fontSize: 14, lineHeight: 1, color: INK_SOFT,- display: 'flex', alignItems: 'center', justifyContent: 'center'- }}- >✕</button></div>- {/* The drop itself — authored HTML, fully sandboxed. */}+ {/* The drop itself. `allow-popups` is the ONLY grant: it is what lets an+ authored <a target="_blank"> reach the OS browser, and it carries no+ script, same-origin, form or navigation rights with it. */}<iframetitle={`What's new in ${version}`}srcDoc={srcDoc}- sandbox=""+ sandbox="allow-popups"referrerPolicy="no-referrer"style={{flex: 1, minHeight: 0, width: '100%', border: 'none',background: '#FBFAF8'}}/>-- {/* Actions live out here: the frame cannot navigate, by design. */}- <div style={{- flexShrink: 0, display: 'flex', alignItems: 'center', gap: 10, flexWrap: 'wrap',- padding: '14px 18px', borderTop: `1px solid ${LINE}`,- background: '#FBFAF8'- }}>- {showStar && (- <button onClick={onStar} style={{- border: 'none', background: 'transparent', cursor: 'pointer', padding: 0,- fontFamily: 'inherit', fontSize: 13, fontWeight: 500,- color: INK_SOFT, textDecoration: 'underline', textUnderlineOffset: 3- }}>⭐ Star us on GitHub</button>- )}- <span style={{ flex: 1 }} />- <button onClick={onDismiss} style={button(false)}>Later</button>- {canRestart ? (- <button onClick={onRestart} disabled={busy} style={button(true)}>- {busy ? 'Restarting…' : 'Restart to update'}- </button>- ) : (- <button onClick={onOpenRelease} style={button(true)}>Open releases</button>- )}- </div></div></div>);diff --git a/src/renderer/src/components/UpdateToast.tsx b/src/renderer/src/components/UpdateToast.tsxindex 821d6481..f9ac5eef 100644--- a/src/renderer/src/components/UpdateToast.tsx+++ b/src/renderer/src/components/UpdateToast.tsx@@ -130,7 +130,10 @@ export function UpdateToast() {// A drop-only release body digests to zero bullets while being the richest// release page we ship, so it has to count too — otherwise the star ask// silently disappears on exactly the releases most worth starring.- const showStar = starAsk && (notes.length > 0 || !!dropHtml)+ // A drop no longer counts. The star ask is a BUTTON, the drop has none, and+ // spending a once-ever ask on a surface that cannot show it burns it for+ // nothing — a drop release that wants a star authors the link in its own HTML.+ const showStar = starAsk && notes.length > 0&& (starSpentOn === null || starSpentOn === version);useEffect(() => {if (showStar && version && starSpentOn === null) {@@ -156,19 +159,17 @@ export function UpdateToast() {};// An authored release: hand the whole moment to the centered drop instead of- // the corner toast. Every action it can take is passed in from here, so the- // sandboxed frame never needs (and never gets) a route back into the app.+ // the corner toast. Nothing is passed in but the content — the drop carries no+ // app buttons, and its own links go out through the OS browser.+ //+ // Restart-to-install is NOT lost with the button: autoInstallOnAppQuit is off,+ // so the update needs an explicit restart, and the title-bar UpdateBadge (and+ // Settings -> Updates) still offer it after this is dismissed.if (dropHtml && version) {return (<ReleaseDropversion={version}html={dropHtml}- canRestart={status.state === 'downloaded'}- busy={busy}- showStar={showStar}- onRestart={() => void restart()}- onOpenRelease={openRelease}- onStar={() => void window.cth.openExternal(GITHUB_REPO_URL)}onDismiss={() => setStatus(null)}/>);diff --git a/src/shared/releaseDrop.ts b/src/shared/releaseDrop.tsindex eb3d3f9d..44d3919c 100644--- a/src/shared/releaseDrop.ts+++ b/src/shared/releaseDrop.ts@@ -19,18 +19,26 @@* it is arbitrary code execution on the user's machine with the app's full* authority, reachable by anyone who can publish a release (or MITM the fetch).*- * So the drop NEVER runs in the app's renderer. It is handed to an iframe with- * `sandbox=""` — the maximally restrictive value: no scripts, no same-origin, no- * forms, no popups, no top-level navigation — and, inside that, a CSP of- * `default-src 'none'` that re-blocks scripts independently. Two unrelated+ * So the drop NEVER runs in the app's renderer. It is handed to an iframe whose+ * sandbox grants exactly one thing — `allow-popups` — and, inside that, a CSP of+ * `default-src 'none'` that blocks scripts independently. Two unrelated* mechanisms, either sufficient alone. `allow-scripts` must NEVER be added* alongside `allow-same-origin`: that pair lets the frame reach out and remove* its own sandbox.*- * What still works, which is everything a launch page actually needs: images,- * video, audio, web fonts, gradients, transforms, keyframe animations, grid.- * What does not: scripts, forms, and links (there is no way to honour a click- * without a script bridge) — the modal's own chrome carries the real actions.+ * Why `allow-popups` and nothing else. The modal deliberately carries no buttons+ * of its own, so the actions a release wants to offer are authored here as+ * ordinary `<a target="_blank">` links. A popup is the weakest possible way to+ * honour one: the frame cannot navigate itself or the top window, it can only+ * ASK for a new window, and main's setWindowOpenHandler denies the window and+ * hands the URL to the OS browser only when it is http(s). No script runs, on+ * either side. A same-frame `<a href>` without target="_blank" still does+ * nothing, which is correct — the drop must never be able to replace itself.+ *+ * What works, which is everything a launch page actually needs: images, video,+ * audio, web fonts, gradients, transforms, keyframe animations, grid, and+ * target="_blank" links out. What does not: scripts, forms, same-frame or+ * top-level navigation, and any URL scheme other than http and https.*/const DROP_OPEN = '<!-- drop -->';diff --git a/test/release-drop.test.cjs b/test/release-drop.test.cjsindex fc3cf79f..99e3ca61 100644--- a/test/release-drop.test.cjs+++ b/test/release-drop.test.cjs@@ -7,10 +7,15 @@* execution with the app's authority, available to anyone who can publish a* release.*- * The controls are (1) `sandbox=""` on the iframe and (2) `default-src 'none'`- * in the document's own CSP. This file pins the half that lives in shared code.- * The sandbox attribute is asserted in ReleaseDrop.tsx and is deliberately NOT- * the only thing standing between a release body and the user's machine.+ * The controls are (1) a minimal sandbox on the iframe and (2) `default-src+ * 'none'` in the document's own CSP. Neither is the only thing standing between+ * a release body and the user's machine.+ *+ * The drop modal carries no buttons, so authored links are how a release offers+ * an action, and the sandbox grants `allow-popups` to make them reach the OS+ * browser. That single grant is now the widest thing in the blast radius, so the+ * last suite here pins it by reading ReleaseDrop.tsx as text — the shared code+ * cannot see the attribute, and a widened sandbox would otherwise pass silently.*/const test = require('node:test');@@ -89,3 +94,30 @@ test('the document is self-contained and declares its charset before content', (assert.ok(doc.indexOf('charset') < doc.indexOf('<body'), 'charset precedes the body');assert.match(doc, /🎉/);});++// ─── The iframe sandbox attribute ────────────────────────────────────────────+// Source-level, on purpose: the attribute lives in a .tsx the loader cannot+// import, and it is the one control this suite would otherwise miss entirely.+// Only the ATTRIBUTE is inspected, never the file text — the doc block above it+// names allow-scripts and allow-same-origin precisely to say they are banned,+// and a grep over prose would fail on the warning rather than on a real grant.+const readDrop = () => require('node:fs').readFileSync(+ require('node:path').join(__dirname, '..', 'src/renderer/src/components/ReleaseDrop.tsx'),+ 'utf8'+);++test('ReleaseDrop grants allow-popups and nothing else', () => {+ const attrs = [...readDrop().matchAll(/sandbox="([^"]*)"/g)].map((m) => m[1]);+ // Exactly one frame, granting exactly one capability. allow-scripts alone is+ // already arbitrary code in the frame; paired with allow-same-origin it lets+ // the frame delete its own sandbox. allow-top-navigation would let a release+ // body replace the app, and allow-forms is an unscripted exfiltration path.+ assert.deepEqual(attrs, ['allow-popups']);+});++// The drop is presentation only. A button here would be an app control wearing+// the release author's page; every action a release wants to offer belongs in+// the authored HTML, which is why the frame can open links at all.+test('ReleaseDrop renders no buttons', () => {+ assert.ok(!/<button/.test(readDrop()), 'the release drop must carry no chrome buttons');+});