Repository navigation
Conversation
… headers (#1091) A self-hosted server put behind an access gateway such as Cloudflare Access was unreachable from the desktop app. The gateway turns away every request that lacks its credentials (a service token is two headers, CF-Access-Client-Id and CF-Access-Client-Secret) before the server sees it, and the app could only send its own auth token. The Auth Token step of Connect to Remote Vault now has Add extra headers, and a saved remote takes the same box under Edit: one `Name: value` per line, Enter for the next line, Cmd/Ctrl+Enter to connect. The step reads exactly as before until the link is chosen, so a server without a gateway costs nothing more. The headers go to the OS secret store beside the token, under their own entry, never to config.toml; a renderer only ever gets their names back. Every request carries them, uploads and asset bytes included, and so does the /api/watch handshake: without them there the socket never opens and live sync quietly drops to the 30 second refresh. One parser in shared-domain decides what a header list is, for the dialog, for main (which re-reads whatever a renderer sends) and for the bundled zn and MCP server, which cannot read the secret store and take the same lines from ZENNOTES_REMOTE_HEADERS. It refuses Authorization (the token has its own field and the server reads it as that token) and the names the connection sets itself, and a list that does not parse is dropped whole rather than sent in part. A gateway that still refuses now says so. An HTML 403 (the ZenNotes server answers in plain text) and a redirect to a sign-in page on another host both name the gateway, instead of quoting its page or failing on a JSON parse. What it deliberately does not do: the phones share this UI but their remote client does not send headers yet, so a capability flag keeps the box hidden there, and the standalone Go zn reads nothing here yet. Headers never go into credentials.toml, because the Go zn owns that file and rewrites it with only its [tokens] table.
The manual said only the zn and MCP server bundled with the app read ZENNOTES_REMOTE_HEADERS, and that the zn installed from Settings → CLI did not. That zn now reads the same variable under the same rules (ZenNotes/tui e443a8b), for zn, zn tui and zn mcp, so the gateway card names it, gives the shell and JSON forms of the value, and says a value that does not parse stops before anything is sent. The CLI card's self-hosted section gains the same one-line pointer, and two comments stop calling the Go zn a gap. It is only true for a zn release that carries e443a8b: the zn this app pins has to move to that release before 2.89.0 ships.
The manual's Saved Remote Workspaces item, which the phones show too, had grown a sentence about extra headers, and the phones' remote client sends none (their box is hidden by supportsRemoteHeaders). The sentence moves to its own Extra headers item marked only: 'desktop', so a phone's manual promises nothing it lacks.
The update window names the one change a self-hoster will look for: Connect to Remote Vault sends extra headers for a server behind an access gateway such as Cloudflare Access (#1091), and where to add them, the Auth Token step's Add extra headers.
zn 0.18.0 (ZenNotes/tui v0.18.0) sends the extra headers in ZENNOTES_REMOTE_HEADERS on every request, live updates included, so zn, zn tui and zn mcp reach a server behind Cloudflare Access the way this app does since 2.89.0 (#1091). The pin is that release's signed terminal-release.json, verified against zn-release-1 and copied byte for byte; the staged binary reports zn v0.18.0. The in-app help's CLI card names 0.18.0 and desktop 2.89.0.
The 2.89.0 gate run's desktop suite passed every test and still failed: vitest caught an unhandled rejection after custom-themes.test.ts had finished. stopWatchingCustomThemes closed the chokidar watcher but left the 200 ms debounce of the last edit running, so the report it then made read the config dir after the test had removed ZENNOTES_CONFIG_DIR, and getConfigDir fell through to electron's `app`, which the test has none of. It has been possible since the watcher grew its error listener (6bf2604), and in the app it could only fire at quit, so no user saw it. The pending timer now lives beside the watcher: a stop clears it, and so does a restart, which also stops a superseded watcher's last edit from reporting into the new one's listener. The new test steps the stop across the window between chokidar settling an edit and the debounce firing; on the old code it catches a report after the stop, and it passes on the fix.
…isories The 2.89.0 gate's production audit listed four moderate advisories, on the lockfile 2.88.0 shipped; some were published after that cut. All four arrive through @modelcontextprotocol/sdk: hono 4.13.7 and @hono/node-server 1.19.17 (serveStatic decoding a path twice, mount() forwarding past middleware, a backslash read as a path separator, a socket reset crashing an async WebSocket upgrade), fast-uri 3.1.7 through ajv (host and scheme normalization from percent-encoding), and ip-address 10.5.0 through express-rate-limit (link-local and NAT64 classification). Each moves to its first version that clears every advisory listed: hono 4.13.16, @hono/node-server 2.1.6, fast-uri 3.1.9, ip-address 10.7.4. The SDK accepts @hono/node-server ^1.19.9 || ^2.0.5, and the 1.x line has no fixed release, so it moves to 2.x. Only these four lock entries change; npm's own resolver leaves the result as is. The app speaks MCP over stdio and never loads hono or its node server (neither is in the bundle); ajv's fast-uri is. The production audit now reports no moderate or higher advisory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ZenNotes 2.89.0: a self-hosted server behind Cloudflare Access is reachable (#1091), zn 0.18.0, four dependency advisories. Gate: 13 checks passed and 1 waived (Cloud UI tests) on
40976f29; Adib's go recorded.ZENNOTES_REMOTE_HEADERS(Custom Headers for remote vault #1091, 250e55b, docs b3f6e79, 07062d7)Verified locally at 40976f2: typecheck, every test suite uncached, build:prod, packaged launch check (page target, rendered, 2.89.0, bundled zn v0.18.0), the three smoke suites. The feature was driven in the built app over CDP through a stub gateway that refuses requests without the Cloudflare headers: refusal named, 13 requests and the WebSocket upgrade passing with them, a note pushed live in 153 ms, the headers back after a relaunch, no value in plain text on disk. Both phone shells walked on the candidate core.