> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# Threat model

> Who and what Bach trusts, what it protects, and where the known gaps are: feed hosts, downloads, elevated steps, the uninstaller and access keys.

This page is for security reviews. It says what Bach trusts, what it doesn't, and what it can't protect against yet. The practical rules are in [Safety rules](/docs/concepts/safety.md).

## Who is trusted for what

| Party | Trusted to | Not trusted to |
| - | - | - |
| The developer (`bach.toml` and files) | Choose what gets installed and run | Write outside the install folder, or name data folders outside the user's profile |
| The build computer | Run `bach build` | Provide a replaced install window program |
| The setup file on a user's computer | Carry what the developer built | Be well-formed; its contents are checked before use |
| The update feed host | Say which version is newest | Change a download without the checksum or signature check catching it |
| A mirror | Offer another place for the same file | Offer another version or checksum |
| The download folder `%LOCALAPPDATA%\Bach\updates` | Hold downloads | Be used without checking the file again |
| Other users and programs | nothing | Change a machine-wide install folder |

## What is protected

* **Users' files:** see [Safety rules](/docs/concepts/safety.md#files).
* **Developers' secrets:** builds stop on files that look like secrets.
* **Updates:** `https` only, checksum, app id and version checks. With `public_key`, signed feeds; with `signer`, an Authenticode check of the downloaded file.
* **Access keys:** sent only to the host they're meant for, redirects followed without them, stored protected for the Windows user.
* **Administrator rights:** requested only when configured; machine-wide folders are checked before anything runs elevated.

## Known gaps

* Without `[updates] public_key` or `signer`, whoever controls the feed host can point users to a different file with a matching checksum.
* A feed signing key can't be revoked remotely. You can [replace it](/docs/guides/update-security.md#change-the-signing-key) in two releases.
* `uninstall.exe` is written on the user's computer and isn't signed.
* A run step with `elevated = true` runs a file from the install folder with administrator rights. Keep it to well-known, signed installers.
* Antivirus software may flag unsigned setup files. See [Antivirus warnings](/docs/guides/antivirus.md).

## Out of scope

* A developer who builds a malicious app.
* An attacker who is already an administrator on the computer.
* The security of your app itself after installation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.