Repository navigation
feat(updates): prompt when a new release ships, with optional install - #88
Conversation
A few seconds after launch (Settings > Updates can turn this off) the app checks for a newer release and shows a popup. Nothing downloads until the user chooses to. - NSIS install and AppImage: electron-updater downloads and verifies the release against its latest.yml, then "Restart & install". - Portable exe and .deb cannot replace themselves, so they look up the latest GitHub release and offer the download page instead. Install mode falls back to this when a release has no readable manifest. - Later hides the popup for this launch; Skip this version persists. A check started from Settings always shows its answer. - Unpackaged (dev, npm) runs never check. - Release workflow now uploads latest.yml, latest-linux.yml and the installer blockmap, and verifies each manifest names this version and a file beside it. Release notes are never rendered; only the version and a release-page link, which main re-validates against the project's releases path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Review Summary
This PR adds a well-structured update-check feature with good security discipline: network-supplied URLs are re-validated before being passed to shell.openExternal, the renderer never receives raw URLs, and electron-updater is loaded lazily. The state machine design and fallback from install to notify mode are sound.
Three issues need addressing before merge:
-
Silenced fallback error (
src/main/update-service.ts): When the installer check fails and the subsequentlookUpRelease()call also fails, the error shown to the user is the installer's original error, not the lookup failure. Add a check forfallback.status === 'error'to surface the correct error. -
URL not fully sanitized (
src/shared/update.ts):safeReleaseUrlvalidates host and path but preserves query strings and fragments from the network response before passing the URL toshell.openExternal. Stripparsed.searchandparsed.hashbefore returning. -
Multi-line
sedcapture breaks CI (.github/workflows/release.yml):sed -n 's/^path: //p'matches allpath:lines inlatest.yml, producing a multi-line string that fails the[[ -f "release-assets/${target}" ]]check. This will block every release publication. Pipe through| head -1to capture only the primary installer path.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
| const fallback = await this.lookUpRelease(); | ||
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | ||
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); |
There was a problem hiding this comment.
🛑 Logic Error: When installer() or checkForUpdates() throws and the subsequent lookUpRelease() also fails (returning { status: 'error' }), the error message shown to the user is taken from the original installer error (shortError(error)) rather than the lookup error. This means a network failure in lookUpRelease is silently swallowed and misattributed to the installer. The user sees an error about the installer even when the real problem was the GitHub API call that happened second.
| const fallback = await this.lookUpRelease(); | |
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | |
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); | |
| const fallback = await this.lookUpRelease(); | |
| if (fallback.status === 'available') return this.set({ ...fallback, mode: 'notify' }); | |
| if (fallback.status === 'error') return this.set(fallback); | |
| return this.set({ status: 'error', ...this.base(), message: shortError(error) }); |
| if (parsed.username || parsed.password) return RELEASES_URL; | ||
| return parsed.toString(); |
There was a problem hiding this comment.
🛑 Security Vulnerability: safeReleaseUrl validates the protocol, host, and pathname but then returns parsed.toString(), which preserves any query string and fragment from the network-supplied URL. A crafted html_url like passes all checks. Strip the search and hash before returning to ensure only a clean, predictable URL reachesshell.openExternal`.1
| if (parsed.username || parsed.password) return RELEASES_URL; | |
| return parsed.toString(); | |
| if (parsed.username || parsed.password) return RELEASES_URL; | |
| parsed.search = ''; | |
| parsed.hash = ''; | |
| return parsed.toString(); |
Footnotes
-
CWE-601: URL Redirection to Untrusted Site ('Open Redirect') - https://cwe.mitre.org/data/definitions/601.html ↩
| for manifest in release-assets/latest.yml release-assets/latest-linux.yml; do | ||
| [[ -f "$manifest" ]] | ||
| grep -qx "version: ${package_version}" "$manifest" | ||
| target="$(sed -n 's/^path: //p' "$manifest")" |
There was a problem hiding this comment.
🛑 Logic Error: sed -n 's/^path: //p' will print all lines starting with path: in the manifest, not just the first. A latest.yml manifest contains multiple path: entries (the installer and its .blockmap), so $target will be a multi-line string. The subsequent [[ -n "$target" && -f "release-assets/${target}" ]] will then fail because release-assets/<multi-line-string> is not a valid file path, causing every release publication to fail. Use head -1 or grep -m1 to capture only the first path.
| target="$(sed -n 's/^path: //p' "$manifest")" | |
| target="$(sed -n 's/^path: //p' "$manifest" | head -1)" |
…nifest path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|



Summary
About 8 seconds after launch, ZeroG checks for a newer release and shows a popup if there is one. Nothing downloads until the user clicks.
latest.yml) → Restart & install.exe,.deblatest.yml. This matters for the first release: the existing v1.0.0 has none.github.com/HappyMonkeyAI/ZeroGTerm/releases/....electron-updater6.8.11. It's loaded only in installable builds.release.ymlnow uploadslatest.yml,latest-linux.ymland the.exe.blockmap, and fails if a manifest doesn't name the tagged version and a file that is present.Verification
npm run typecheck✅,npm run build✅,npm test✅ (68 files, 1229 passed). Newtests/update.test.ts: 26 tests covering mode detection, version ordering, URL validation, popup rules, and the service state machine with a fake updater.-c.npmRebuild=false, because node-pty's gyp rebuild fails on this machine). Output:latest.ymlnamesZeroGTerminal-1.0.0-Setup.exewith its sha512, andresources/app-update.ymlpoints at this repo.--user-data-dir, driven over CDP:latest.yml, so it fell back and showed "Version 1.0.0 is available" with Open download page.🤖 Generated with Claude Code