What is always checked
- Downloads use
httpsonly, including redirects. - The downloaded file must match the checksum (SHA-256) in the feed.
- It must be a setup file for the same app id, with the version the feed announced.
- It’s checked again right before it runs, not only after downloading.
Sign the update feed
You create a key pair once. The private key stays with you; the public key goes into your setup files. Installed apps then only accept feed entries signed with your private key.feed-key.private and prints the public key. It refuses to overwrite an existing file. Put the public key in bach.toml:
bach.toml
BACH_FEED_KEY (the key itself) works too, for example as a CI secret. Without the key, bach build writes an unsigned feed and warns; bach feed refuses.
On Linux and macOS the new key file is readable only by you. On Windows it has the permissions of its folder, so keep it somewhere private.
The signature covers the version, links, checksums, size, rollout and patch. Release notes aren’t signed.
Expire old feed entries
A signature proves who wrote an entry, not when. Someone who controls your host could keep serving an old, correctly signed entry, so users never see a security fix. To limit that:bach.toml
bach feed and uploads latest.json. Otherwise your users stop getting updates.
Change the signing key
If the key leaks or you want a new one, installed apps have to learn the new key while the old one still works:- Make a new key with
bach feed-key, keeping the old one. Release a version with the old key aspublic_keyand the new one asnext_public_key. Sign that release’s feed with the old key. - Wait until most users have that version. Then release with only the new key as
public_key, and sign with the new key.
Require your code signature
If you sign your setup files, the installed app can also require that updates are signed by you:bach.toml
bach.toml
- Sign every file you publish, including patches.
bach build --signchecks that the certificate matchessignerand stops the build if not. - The first version with
signerhas to be installed by hand, because older copies don’t know the rule. - If your certificate’s name changes, you have to give users a new setup file.
On a Mac
On a Mac, the samesigner checks the Setup app inside the downloaded .dmg or .zip. It has to be signed with a Developer ID Application certificate that Apple issued, with that name. Self-signed and ad hoc signatures are refused. This needs Bach 0.11.2 or newer.
A full subject on a Mac has only two parts, such as CN=Example Inc., OU=ABCDE12345, where OU is your team id. A full subject only matches the system it was written for, so an app that ships on Windows and macOS needs the plain name, and both certificates have to carry it.
Since Bach 0.11.3, bach build checks this before you publish. With --sign, a certificate that installed Macs would refuse stops the build. Without --sign, the build succeeds and warns that installed copies will refuse the file. bach sign checks a .dmg or .zip too. None of these checks ask whether the app was notarized.