From af669ebb07d33a143e5917ec8fc4e28ae5ce30d9 Mon Sep 17 00:00:00 2001 From: Stephen Phillips Date: Tue, 10 Nov 2026 11:03:26 +0000 Subject: [PATCH 1/2] fix: bundle fonts locally and show endpoint warnings in speech settings Fonts - Inter and JetBrains Mono now come from @fontsource-variable packages bundled by Vite instead of Google Fonts, so launching makes no network request and the UI renders correctly offline - CSP drops fonts.googleapis.com / fonts.gstatic.com (font-src 'self') - THIRD-PARTY-NOTICES.md carries the OFL text and ships in the package Endpoint warnings - endpointNotices(url, hasKey) in src/shared/endpoints.ts turns the existing isSupportedEndpoint / isLoopbackEndpoint / sendsKeyInClear helpers into settings-panel messages; they were never shown before - Speech settings show them under Server URL when the engine is Server: red for an invalid URL or a key over plain http off-machine, amber when speech leaves the machine - endpoints.ts header no longer mentions features this app doesn't have SECURITY.md updated to match. Co-Authored-By: Claude Opus 5.5 --- README.md | 2 +- SECURITY.md | 6 +-- THIRD-PARTY-NOTICES.md | 102 ++++++++++++++++++++++++++++++++++++++++ index.html | 8 +--- package-lock.json | 22 +++++++++ package.json | 6 ++- src/renderer/main.tsx | 17 +++++++ src/renderer/styles.css | 30 +++++++++++- src/shared/endpoints.ts | 38 +++++++++++++-- tests/endpoints.test.ts | 47 ++++++++++++++++++ 10 files changed, 259 insertions(+), 19 deletions(-) create mode 100644 THIRD-PARTY-NOTICES.md create mode 100644 tests/endpoints.test.ts diff --git a/README.md b/README.md index 15f520f..10c78fd 100644 --- a/README.md +++ b/README.md @@ -69,4 +69,4 @@ Signing is off (`signAndEditExecutable: false`). App id: `com.happymonkeyai.zero ## License -[MIT](LICENSE) +[MIT](LICENSE). Bundled fonts are under the SIL Open Font License; see [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md). diff --git a/SECURITY.md b/SECURITY.md index e113a8e..55037b5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -15,7 +15,7 @@ ZeroG FileMan is a local Electron app. It works on your own files with your own - **Renderer isolation.** The page talks to the app only through the `window.fileman` preload bridge. The main process validates every path it is given (`resolveLocalPath`) before touching the filesystem, and the window refuses to navigate away from the app's own origin. - **No shell interpolation.** External programs, such as a terminal opened at a folder, are spawned with argument arrays, never through a shell string. - **Secrets stay in main.** The optional speech server API key is encrypted with Electron `safeStorage`. The renderer can save, clear or check the key, but cannot read it back. If OS encryption is unavailable, the key is held in memory only and never written to disk. -- **Narrow network surface.** The page CSP allows `fetch` connections only to the app itself and to the Hugging Face hosts that the built-in Whisper engine downloads its model from (once, then cached). The UI fonts (Inter, JetBrains Mono) load from Google Fonts. Requests to a user-configured speech server are made by the main process (see [ADR-0005](docs/adr/0005-server-speech-requests-in-main.md)). +- **Narrow network surface.** The page CSP allows connections only to the app itself and to the Hugging Face hosts that the built-in Whisper engine downloads its model from (once, then cached). Fonts are bundled, so launching the app makes no network requests. Requests to a user-configured speech server are made by the main process (see [ADR-0005](docs/adr/0005-server-speech-requests-in-main.md)). ### Where your data goes @@ -23,9 +23,9 @@ ZeroG FileMan is a local Electron app. It works on your own files with your own |---------------|---------------------------| | Demo (typed transcript) | No | | Built-in Whisper | No. Only the model download contacts Hugging Face. | -| OpenAI-compatible server | Yes, to the URL you configure, along with your API key if one is set. Use `https` for anything not on this machine. | +| OpenAI-compatible server | Yes, to the URL you configure, along with your API key if one is set. The settings panel warns when that URL is not on this machine, and in red when a key would be sent over plain `http`. | -There is no telemetry. Other than the font and model downloads and your configured speech server, the app makes no network requests. +There is no telemetry. Other than the Whisper model download and your configured speech server, the app makes no network requests. ## Out of scope diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md new file mode 100644 index 0000000..669875b --- /dev/null +++ b/THIRD-PARTY-NOTICES.md @@ -0,0 +1,102 @@ +# Third-party notices + +ZeroG FileMan bundles these fonts in its renderer build. Both are licensed under the SIL Open Font License 1.1, reproduced below. + +- **Inter**: Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter), via `@fontsource-variable/inter` +- **JetBrains Mono**: Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono), via `@fontsource-variable/jetbrains-mono` + +## SIL Open Font License 1.1 + +```text +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. +``` diff --git a/index.html b/index.html index 46ccca6..af9dacd 100644 --- a/index.html +++ b/index.html @@ -4,15 +4,9 @@ - - - ZeroG FileMan diff --git a/package-lock.json b/package-lock.json index 91133ea..2812f78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,8 @@ "react-dom": "^19.1.1" }, "devDependencies": { + "@fontsource-variable/inter": "^5.3.0", + "@fontsource-variable/jetbrains-mono": "^5.3.0", "@types/node": "^24.13.3", "@types/react": "^19.2.18", "@types/react-dom": "^19.2.6", @@ -1077,6 +1079,26 @@ "node": ">=18" } }, + "node_modules/@fontsource-variable/inter": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource-variable/inter/-/inter-5.3.0.tgz", + "integrity": "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==", + "dev": true, + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource-variable/jetbrains-mono": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource-variable/jetbrains-mono/-/jetbrains-mono-5.3.0.tgz", + "integrity": "sha512-F32xpS2NsGYoQi2ADSkKTgpJj7ozajsGgDJ8woTnqjmIB+dxDIqImjl4pXZVEExu8UFZ2ndhmX18EBS/hdz3Lw==", + "dev": true, + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, "node_modules/@huggingface/jinja": { "version": "0.5.11", "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.5.11.tgz", diff --git a/package.json b/package.json index bff1838..8253e71 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,8 @@ "react-dom": "^19.1.1" }, "devDependencies": { + "@fontsource-variable/inter": "^5.3.0", + "@fontsource-variable/jetbrains-mono": "^5.3.0", "@types/node": "^24.13.3", "@types/react": "^19.2.18", "@types/react-dom": "^19.2.6", @@ -55,7 +57,9 @@ "files": [ "dist/main/**/*", "dist/renderer/**/*", - "package.json" + "package.json", + "LICENSE", + "THIRD-PARTY-NOTICES.md" ], "win": { "icon": "build/icon.ico", diff --git a/src/renderer/main.tsx b/src/renderer/main.tsx index 88d8fa8..efc4272 100644 --- a/src/renderer/main.tsx +++ b/src/renderer/main.tsx @@ -21,6 +21,7 @@ import { parentLocal } from '../shared/files.js'; import type { ContextMenuTargetKind } from '../shared/context-menu.js'; +import { endpointNotices } from '../shared/endpoints.js'; import { entryNameProblem } from '../shared/entry-name.js'; import { describeError, runReported } from '../shared/file-op.js'; import { fuzzyMatchEntries, fuzzyMatchHits, parseActionCommand } from '../shared/fuzzy-path.js'; @@ -91,6 +92,10 @@ import { } from './themes.js'; import { loadStoredTranscriptDrawer, storeTranscriptDrawer } from './transcript-prefs.js'; import { isMostlySilence, VoiceRecorder } from './voice.js'; +// Fonts are bundled rather than fetched from Google Fonts, so a launch makes +// no network request and the UI looks the same offline. +import '@fontsource-variable/inter'; +import '@fontsource-variable/jetbrains-mono'; import './styles.css'; type VoicePhase = 'idle' | 'listening' | 'transcribing'; @@ -2229,6 +2234,18 @@ function App() { + {speechSettings.engine === 'server' ? ( +
+ {endpointNotices( + speechSettings.serverUrl, + speechKeyStatus.stored || speechKeyDraft.trim() !== '' + ).map((notice) => ( +
+ {notice.text} +
+ ))} +
+ ) : null} ) : null} {!transcriptDrawer.collapsed || speechSettingsOpen ? ( diff --git a/src/renderer/styles.css b/src/renderer/styles.css index e2030da..c62f234 100644 --- a/src/renderer/styles.css +++ b/src/renderer/styles.css @@ -21,8 +21,8 @@ --heading-bg: #0a101a; --input-bg: #070b12; --topbar: #080d16; - --font: 'Inter', 'Segoe UI', system-ui, sans-serif; - --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace; + --font: 'Inter Variable', 'Segoe UI', system-ui, sans-serif; + --mono: 'JetBrains Mono Variable', 'Cascadia Code', Consolas, monospace; } :root[data-theme='light'] { @@ -1130,6 +1130,32 @@ select { flex: 1; } +.endpoint-notices { + grid-column: 1 / -1; + display: flex; + flex-direction: column; + gap: 2px; +} + +.endpoint-notices:empty { + display: none; +} + +.endpoint-notice { + font-family: var(--mono); + font-size: 10px; + padding-left: 6px; + border-left: 2px solid currentColor; +} + +.endpoint-notice-warn { + color: var(--warn); +} + +.endpoint-notice-danger { + color: var(--danger); +} + /* —— Status bar —— */ .statusbar { display: flex; diff --git a/src/shared/endpoints.ts b/src/shared/endpoints.ts index 55d5526..825e3cc 100644 --- a/src/shared/endpoints.ts +++ b/src/shared/endpoints.ts @@ -1,10 +1,9 @@ // What counts as an endpoint ZeroG will make a request to, and what is worth // saying about one before it is used. // -// Shared rather than owned by the speech side because the AI suggestion path now -// asks the same three questions of the same kind of URL, and the answers must -// match: a settings panel that warns a key travels in the clear for one feature -// and not the other would be worse than either behaviour on its own. +// Shared rather than owned by the speech side so that any future feature that +// calls a user-configured endpoint asks the same questions and gets the same +// answers — and the settings panel says the same things about it. // // The host is the operator's choice — loopback, the LAN, or a hosted service — // and nothing here refuses one on that basis. What is enforced is the shape: an @@ -50,7 +49,7 @@ export function isSupportedEndpoint(url: string): boolean { * Does this endpoint keep the payload on this machine? * * Nothing is refused on this basis; the settings panel uses it to say plainly - * when recorded speech or terminal output is about to leave the machine. + * when recorded speech is about to leave the machine. * `*.localhost` resolves to loopback by specification, so it counts. */ export function isLoopbackEndpoint(url: string): boolean { @@ -72,3 +71,32 @@ export function sendsKeyInClear(url: string): boolean { if (parsed === null) return false; return parsed.protocol === 'http:' && !isLoopbackEndpoint(url); } + +export type EndpointNotice = { tone: 'warn' | 'danger'; text: string }; + +/** + * What the settings panel should say about a speech server URL, worst first. + * + * An empty field says nothing — it is not a mistake yet. `hasKey` is whether a + * key is saved or typed: the clear-text warning is only worth showing when there + * is a key to leak. + */ +export function endpointNotices(url: string, hasKey: boolean): EndpointNotice[] { + const trimmed = url.trim(); + if (trimmed === '') return []; + const parsed = endpointOf(trimmed); + if (parsed === null) { + return [{ tone: 'danger', text: 'Not an http(s) URL with a host — transcription requests will be refused.' }]; + } + const notices: EndpointNotice[] = []; + if (hasKey && sendsKeyInClear(trimmed)) { + notices.push({ + tone: 'danger', + text: `Your API key will be sent unencrypted over http to ${parsed.host}. Use https.` + }); + } + if (!isLoopbackEndpoint(trimmed)) { + notices.push({ tone: 'warn', text: `Recorded speech leaves this machine: it is sent to ${parsed.host}.` }); + } + return notices; +} diff --git a/tests/endpoints.test.ts b/tests/endpoints.test.ts new file mode 100644 index 0000000..2bc1486 --- /dev/null +++ b/tests/endpoints.test.ts @@ -0,0 +1,47 @@ +import { describe, expect, it } from 'vitest'; +import { endpointNotices } from '../src/shared/endpoints.js'; + +const tones = (url: string, hasKey: boolean) => endpointNotices(url, hasKey).map((n) => n.tone); + +describe('endpointNotices', () => { + it('says nothing about an empty or blank field', () => { + expect(endpointNotices('', true)).toEqual([]); + expect(endpointNotices(' ', true)).toEqual([]); + }); + + it('says nothing about a loopback server, key or not, http or not', () => { + for (const url of [ + 'http://127.0.0.1:8080/v1/audio/transcriptions', + 'http://localhost:8080/v1', + 'http://[::1]:8080/v1', + 'http://whisper.localhost/v1' + ]) { + expect(endpointNotices(url, true)).toEqual([]); + } + }); + + it('refuses things that are not http(s) URLs with a host', () => { + for (const url of ['file:///C:/x', 'ws://10.0.0.5/v1', 'not a url', '10.0.0.5:8080']) { + expect(tones(url, false)).toEqual(['danger']); + expect(endpointNotices(url, false)[0].text).toMatch(/refused/); + } + }); + + it('warns that speech leaves the machine for any non-loopback host', () => { + const notices = endpointNotices('https://api.example.com/v1/audio/transcriptions', true); + expect(notices).toHaveLength(1); + expect(notices[0]).toMatchObject({ tone: 'warn' }); + expect(notices[0].text).toContain('api.example.com'); + }); + + it('flags a key sent over plain http to another host, worst first', () => { + const notices = endpointNotices('http://10.0.0.5:8080/v1/audio/transcriptions', true); + expect(notices.map((n) => n.tone)).toEqual(['danger', 'warn']); + expect(notices[0].text).toMatch(/unencrypted/); + expect(notices[0].text).toContain('10.0.0.5:8080'); + }); + + it('does not flag clear-text http when there is no key to leak', () => { + expect(tones('http://10.0.0.5:8080/v1', false)).toEqual(['warn']); + }); +}); From dd1354772709c3d77db4c12626cc9b515eb2dff2 Mon Sep 17 00:00:00 2001 From: Stephen Phillips Date: Tue, 10 Nov 2026 11:10:33 +0000 Subject: [PATCH 2/2] docs: explain why LOOPBACK_HOSTNAMES keeps the bracketed [::1] URL.hostname keeps brackets on IPv6 literals, so '[::1]' is the entry that matches. A review bot suggested removing it as dead code; doing so would flag a local [::1] server as off-machine. Add a comment and a test case with the expanded [0:0:0:0:0:0:0:1] form; removing '[::1]' now fails the loopback test. Co-Authored-By: Claude Opus 5.5 --- src/shared/endpoints.ts | 4 ++++ tests/endpoints.test.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/shared/endpoints.ts b/src/shared/endpoints.ts index 825e3cc..72863ca 100644 --- a/src/shared/endpoints.ts +++ b/src/shared/endpoints.ts @@ -10,6 +10,10 @@ // http(s) URL with a host, so a typo or a file:// path cannot become a request. // See SECURITY.md. +// `URL.hostname` keeps the brackets on IPv6 literals: `new URL('http://[::1]/')` +// has hostname `[::1]`, and so does `[0:0:0:0:0:0:0:1]`. The bracketed entry is +// the one that matches; do not "tidy" it away. Bare `::1` never comes out of +// URL parsing and is kept only as a harmless belt-and-braces entry. const LOOPBACK_HOSTNAMES = new Set(['127.0.0.1', 'localhost', '::1', '[::1]']); /** The endpoint as a URL, or null when it is not one a request can be made to. */ diff --git a/tests/endpoints.test.ts b/tests/endpoints.test.ts index 2bc1486..5229a8a 100644 --- a/tests/endpoints.test.ts +++ b/tests/endpoints.test.ts @@ -14,6 +14,8 @@ describe('endpointNotices', () => { 'http://127.0.0.1:8080/v1/audio/transcriptions', 'http://localhost:8080/v1', 'http://[::1]:8080/v1', + // Normalises to hostname `[::1]` — brackets included. Guards LOOPBACK_HOSTNAMES. + 'http://[0:0:0:0:0:0:0:1]:8080/v1', 'http://whisper.localhost/v1' ]) { expect(endpointNotices(url, true)).toEqual([]);