The rules
Packaged paths cannot leave the install folder
Packaged paths cannot leave the install folder
.., so a setup file cannot write outside its install folder. Paths from a payload are untrusted and always checked before anything touches the disk.Data folders stay inside the user's profile
Data folders stay inside the user's profile
%APPDATA%, %LOCALAPPDATA%, %USERPROFILE%) and name a folder of their own: never Documents, Desktop, AppData or another profile folder, never anything inside .ssh or Microsoft, never developer tool folders, browser or chat profiles of other programs or NTUSER.DAT, and never the install folder or a folder that contains it. They are deleted only when the user ticks the box, and the removal window lists the real folders under it.The uninstaller removes only what it installed
The uninstaller removes only what it installed
bach-setup.exe runtime that ends up in every setup file is downloaded over https only and checked against a SHA-256 built into a released bach. A cached copy is checked again before use, and the cache never falls back to the shared temp folder. bach check and bach build refuse a source folder that holds secrets such as .env files, private keys, .git or bach.toml, (and many more credential files, and keys or tokens inside small text files) unless files.allow_secrets names them. A first install into a folder that already holds files of the same names warns in the window, naming them, and a silent run refuses unless it gets --overwrite. The uninstaller keeps a file that was changed after setup wrote it. It deletes only files listed in its manifest, inside a folder that is verifiably the app’s install. It refuses a folder that does not hold the app, and an update only cleans up after an earlier install of the same app id.Administrator rights only when the app says so
Administrator rights only when the app says so
HKCU. It asks once, through Windows’ own prompt, only when the app sets installer.scope = "machine", marks a [[run]] step elevated = true or allows an elevated [[migrate]]. Before it writes into a machine-wide install folder, and again before an elevated update or removal, setup reads the folder’s access list and refuses one that Users, Authenticated Users or Everyone may change, or that Administrators, SYSTEM and TrustedInstaller do not own. A machine-wide uninstaller removes itself from where it is instead of from a copy in the user’s temp folder, and setup files load only System32’s DLLs, never one planted next to the setup file. See machine-wide installs.The manifest is checked again at start
The manifest is checked again at start
Keys are checked first, and kept sealed
Keys are checked first, and kept sealed
[access] checks the key before anything on the computer is touched. Files are encrypted with Argon2id and ChaCha20-Poly1305 in authenticated chunks, so a changed or cut-short setup file fails instead of unpacking something wrong. A setup file that asks for unreasonable key-derivation costs is refused. The key kept for updates is sealed with the Windows Data Protection API for that user, and is sent only to the host it was meant for.Run steps are the app's own files
Run steps are the app's own files
[[run]] step starts only a packaged file inside the install folder, as the user unless it says elevated = true, never through a shell. An elevated program is checked against its recorded SHA-256 right before Windows is asked for administrator rights. Setup waits for a step and ends it after 15 minutes (an elevated step in a per-user setup can only be waited out, not ended). A failing step before removal never stops the removal.Migration runs only an entry's uninstall command
Migration runs only an entry's uninstall command
[[migrate]] runs the uninstall command of the Settings › Apps entry you name, never through a shell and never so that it stops the install. An elevated setup ignores per-user entries, and a machine-wide old uninstaller runs elevated only from Program Files or the Windows folder. Windows’ folders come from Windows, not from environment variables.Signing runs only when you ask
Signing runs only when you ask
[signing] section names a program, so bach build runs it only with --sign or BACH_SIGN=1. A bach.toml from somewhere else never runs a program just because it was built.A patch is only good for the version it was made for
A patch is only good for the version it was made for
Mirrors cannot widen trust
Mirrors cannot widen trust
PATH is edited as raw text
PATH is edited as raw text
REG_EXPAND_SZ) is kept, and nothing is written when there is nothing to change. The rest of PATH is kept byte for byte.Foreign registry keys are never touched
Foreign registry keys are never touched
BachApp mark. Keys without it belong to another program and are never changed or deleted.No Visual C++ redistributable needed
No Visual C++ redistributable needed
Rules the config checker enforces
Fix the settingbach check names rather than working around it:
- Data folders must start with
%APPDATA%,%LOCALAPPDATA%or%USERPROFILE%plus the app’s own folder. - The source folder cannot contain symbolic links or a top-level
uninstall.exe. - Schemes like
httpand extensions like.exeare refused. [text]keys must be real text names.- The update feed and requirement downloads must be https.
Updates are verified
A self-update downloads over https only. The file is checked against the feed’s SHA-256 and must be a setup file for the same app id and the version the feed names, so a wrong or tampered file is never run. A downloaded file waiting in the update folder is checked again right before it runs, never trusted because of where it is. The SHA-256 comes from the same place as the file, so it guards against damage and a wrong file, not against someone who controls the release page. Signing the setup file (Signing) is what lets Windows show your name. Automatic updates are a per-user scheduled task that needs no administrator rights, and an update only installs while the app is closed. A machine-wide app has no background updates, because its update has to write to Program Files. A power cut in the middle of an update is undone by the next run, using a journal that can only act on paths inside the install folder.What is not a vulnerability
Bach packages what you give it. A setup file is as trustworthy as the app inside, so a developer putting something harmful into their ownbach.toml or app files is not a Bach vulnerability. See the security policy for how to report a problem.