fix: harden auto-updater (signature verification, pinned download host) + minor supply-chain tidy-ups#70
Open
Owen-Interruptive wants to merge 2 commits into
Conversation
- Reject release assets not hosted on this repo's GitHub releases URL - Require downloaded .app to pass codesign --verify --deep --strict and match the running app's Team ID before installing (refuses to update unsigned builds rather than silently trusting any DMG) - Pass app paths to /bin/sh as $0 positional args instead of string interpolation in both relaunch helpers
|
@Owen-Interruptive is attempting to deploy a commit to the knox projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
What
Hardens the in-app auto-updater and tidies a couple of related supply-chain weak spots found during a security review of the codebase.
1. Auto-updater: verify before install (
AppUpdater.swift)Previously
installUpdatemounted the downloaded DMG and copied the first.appit found straight over the running bundle — no signature, checksum, or notarization check. That means anyone able to tamper with the release (compromised account, malicious asset) gets silent arbitrary code execution on every install at next launch.This PR:
https://github.com/KartikLabhshetwar/better-shot/releases/download/...; a tamperedbrowser_download_urlin the release JSON can no longer redirect the binary download elsewhere.codesign --verify --deep --strictand have the same Team ID as the running app. If the running app is unsigned (e.g. a localmake build), the updater refuses to install rather than trusting any DMG — failing closed seemed like the right default. Official signed releases update normally.2. Shell-string interpolation in relaunch helpers
relaunchApp(AppUpdater.swift) andpromptRestart(BetterShotDelegate.swift) interpolated the app path into a/bin/sh -c "... open \"path\""string. A path containing"or$(...)would be interpreted by the shell. Both now pass the path as a$0positional argument — same behavior, no interpolation.3. Landing page: pin
"latest"dependenciesSix deps in
bettershot-landing/package.jsonwere specified as"latest", so any upstream publish would be auto-adopted on a non-frozen install. Pinned each to the version already resolved inpnpm-lock.yaml(no lockfile change needed).Testing
make buildsucceeds; app runs normally (menu bar, capture, hotkeys).Notes
make shipreferencesscripts/release.sh, which isn't in the repo, so the release/signing pipeline isn't auditable from source. Committing it (or a sanitized version) would close the loop on the supply-chain story.