Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
6 changes: 3 additions & 3 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ 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

| Speech engine | Audio leaves the machine? |
|---------------|---------------------------|
| 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

Expand Down
102 changes: 102 additions & 0 deletions THIRD-PARTY-NOTICES.md
Original file line number Diff line number Diff line change
@@ -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.
```
8 changes: 1 addition & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data:; script-src 'self'; connect-src 'self' https://huggingface.co https://*.huggingface.co https://*.hf.co; media-src 'self' blob:"
content="default-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; img-src 'self' data:; script-src 'self'; connect-src 'self' https://huggingface.co https://*.huggingface.co https://*.hf.co; media-src 'self' blob:"
/>

Check warning on line 8 in index.html

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make sure allowing 'unsafe-inline' in this Content Security Policy directive is safe here.

See more on https://sonarcloud.io/project/issues?id=HappyMonkeyAI_ZeroGFileMan2&issues=AaHFMbZTl8b0_V6vG9Yy&open=AaHFMbZTl8b0_V6vG9Yy&pullRequest=2

Check warning on line 8 in index.html

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make sure allowing wildcards in this Content Security Policy directive is safe here.

See more on https://sonarcloud.io/project/issues?id=HappyMonkeyAI_ZeroGFileMan2&issues=AaHFMbZTl8b0_V6vG9Yz&open=AaHFMbZTl8b0_V6vG9Yz&pullRequest=2
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
rel="stylesheet"
/>
<title>ZeroG FileMan</title>
</head>
<body>
Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -55,7 +57,9 @@
"files": [
"dist/main/**/*",
"dist/renderer/**/*",
"package.json"
"package.json",
"LICENSE",
"THIRD-PARTY-NOTICES.md"
],
"win": {
"icon": "build/icon.ico",
Expand Down
17 changes: 17 additions & 0 deletions src/renderer/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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';
Expand Down Expand Up @@ -91,6 +92,10 @@
} 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';
Expand Down Expand Up @@ -1235,7 +1240,7 @@
return false;
}

function App() {

Check failure on line 1243 in src/renderer/main.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 54 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=HappyMonkeyAI_ZeroGFileMan2&issues=AaHFMbX8l8b0_V6vG9Yx&open=AaHFMbX8l8b0_V6vG9Yx&pullRequest=2
const [left, setLeft] = useState<PaneState | null>(null);
const [right, setRight] = useState<PaneState | null>(null);
const [active, setActive] = useState<'left' | 'right'>('left');
Expand Down Expand Up @@ -2229,6 +2234,18 @@
</button>
</div>
</label>
{speechSettings.engine === 'server' ? (
<div className="endpoint-notices" role="status" aria-live="polite">
{endpointNotices(
speechSettings.serverUrl,
speechKeyStatus.stored || speechKeyDraft.trim() !== ''
).map((notice) => (
<div key={notice.text} className={`endpoint-notice endpoint-notice-${notice.tone}`}>
{notice.text}
</div>
))}
</div>
) : null}
</div>
) : null}
{!transcriptDrawer.collapsed || speechSettingsOpen ? (
Expand Down
30 changes: 28 additions & 2 deletions src/renderer/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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'] {
Expand Down Expand Up @@ -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;
Expand Down
42 changes: 37 additions & 5 deletions src/shared/endpoints.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// 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
// 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. */
Expand Down Expand Up @@ -50,7 +53,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 {
Expand All @@ -72,3 +75,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;
}
Loading
Loading