What Latchkey protects, and where it stops
Latchkey keeps secret values out of files and transcripts, and makes you the one who decides which command gets which value. Every mechanism has a boundary, and the boundaries matter as much as the mechanisms.
A reference in a committed file names the item and nothing more. A script that asks Latchkey directly, instead of through the signed lk tool, is named by its path with a warning, and is refused unless you allow it. The scene uses example data.
Six distinctions worth knowing
- The keychain protects stored values, not released ones.Once a command has a value, it's in that command's memory and environment, and Latchkey can't control what it does with it: print it, write it to a file or send it on. Masking catches exact copies in output, not changed ones.
- A reference names a secret; it doesn't grant access to it.
latchkey://shop/development/STRIPE_KEYin a committed file reveals a name. Reading the item still needs it to be agent-safe, a grant covering the caller, or your approval. - A proxy hides a key without narrowing what it can do.With
--proxythe command never holds the OpenAI or Anthropic key, but it can still make any call that key allows through the proxy.--proxy-modelsand--proxy-requestsnarrow that. - iCloud Keychain sync is separate from agent authorization.Items and environment records sync to your Macs. Grants don't: each is kept on the Mac where you made it.
- The access log records releases, not provider-side use.It shows what Latchkey gave to which program, from where. What that program then did at the service is the service's record.
- A shared credential means fewer copies of the same authority.One shared item used by five projects is one value to rotate, and still one key that all five can use.
Storage
Values live in the keychain, behind the signed app.
- Values are generic-password items in the data-protection keychain, in an access group only the signed Latchkey app can use. Versions, remote links, environment records and project links are keychain items too; records and links hold item IDs, remotes and plain settings, nothing secret. A plain setting that looks secret is refused.
- One process holds values. The command-line tool never touches the keychain; it asks the app over a Unix socket readable and writable only by you, and the app accepts connections only from your user account.
- Before sending anything, a signed
latchkeychecks that the program on the socket is the Latchkey app signed by the same team. A program that took the socket while the app wasn't running gets nothing, not even a value you're saving. An unsigned development build can't check, and falls back to the login keychain on one Mac. - Synced items use the "after first unlock" protection class, so scheduled jobs can read agent-safe items while the screen is locked.
Sync between Macs
iCloud Keychain carries items; permissions stay put.
Latchkey's items sync through iCloud Keychain, end to end encrypted, to each Mac signed in to your Apple Account that has Latchkey installed. There's no Latchkey server or account. That protection is Apple's: anyone who controls your Apple Account and a trusted device can reach synced items. Apple describes it in iCloud Keychain security overview and iCloud data security overview.
Grants, approvals and the access log stay on each Mac. A second Mac gets your items and environment records, not the permissions you gave agents on the first. Second-Mac test pending
Who's asking
Identity comes from the kernel, not the request.
- For each connection the app gets the caller's identity from the kernel, not from the request: its working folder, its command line, its parent processes, and whether it is Latchkey's own command-line tool, by code signature.
- The approval panel and the log show those. Any other program talking to the socket is named by its path, with a warning. Grants are matched against the folder the caller really runs in.
- The caller is checked by signature; its parents are named by their files, and file names can be faked. Judge a request by its folder and command as well.
Releasing values
Approvals, grants, and items agents may read.
Approvals
Approvals use macOS LocalAuthentication: Touch ID, a paired Apple Watch, or your account password. Every request shows Latchkey's panel with what it covers and the caller's folder, command and process chain, and Touch ID is read inside the panel; Use Password… opens the system sheet. Touch ID runs in the Secure Enclave either way, so a lookalike panel drawn by another app gets a touch that authorizes nothing. Requests from the same process tree in the same folder that arrive while the panel is up are listed in it and answered by one touch, and a request joining restarts Touch ID. Pushes, requests over SSH, from Latchkey for Safari or from a program that isn't identified are always asked on their own. Nothing unanswered is allowed: a request is denied after two minutes. Allow Once authorizes one request; approvals are never cached.
A request doesn't hold Latchkey while it waits for you. When you answer, it runs again from the start and uses your answer only if it asks the same thing about values that haven't changed; otherwise it asks again.
App lock
Latchkey's window, Settings and menu bar panel lock behind Touch ID (in the lock screen or the menu bar panel itself) or your Mac password when it opens, after time in the background and when the Mac sleeps or the screen locks, and revealed values are hidden. The lock keeps the window private; it doesn't decide what's released. Requests from commands, agents and Safari still go through approval, locked or not.
Grants
A grant lets commands from one folder (and its repository's worktrees) read named items without asking, for as long as the approval says (any length of time, or until you revoke it), and can be narrowed to an agent's session, one command or one request. Grants are kept in a keychain item only Latchkey can read or change, on this Mac only. No file holds them, so no other program can write itself one. Grants an agent asks for through the MCP server cover only its own folder, end with the agent's session, and can't include production.
Agent-safe items
An item marked agent-safe is released to any program that asks, with no prompt. Use it for values that aren't really secret, such as NEXT_PUBLIC_* settings that ship to browsers anyway.
How a command gets a value
The guarantee depends on which path a value takes into the command.
| Path | What the command holds | What it protects |
|---|---|---|
lk run | The value, in its environment | Files and transcripts hold references; output that repeats an exact value of 6 characters or more is masked. |
--proxy | A random placeholder and a base URL on 127.0.0.1 | The OpenAI or Anthropic key stays in the signed lk process and goes only to the provider's own host. Requests without that run's placeholder are refused; upstream redirects aren't followed. |
--aws-session | STS credentials that expire (15 minutes by default) | The long-lived AWS key stays in lk run. A leaked value soon stops working. |
--file | The path of a temporary file | The file is in a new folder only you can open, readable only by you, and deleted when the command exits. |
export --values | A plain-text file | Asks every time, naming the file; nothing stands in for that approval. Written readable only by you and renamed into place. Agents can't use it. |
Latchkey for Safari
Sandboxed, and limited to names, saves and one fill.
The extension is sandboxed and reaches the app through its own socket, which admits only Latchkey's signed extension and only to list item names, save a value (which asks like any change) and fill one item into the page you're on. Key detection runs inside the page: a value goes to the app only when you press Save. Password fields aren't read. Fill asks every time, works only on the item's fill sites (by default its service's own site and deployment platforms), over https only, never in a frame, and is logged. Otherwise it can't read a stored value.
The access log
Every read, change, grant, move, import and push is logged with the program chain and folder. Stored values aren't logged; likely secrets in command arguments are replaced with <redacted>, which is heuristic, so keep values out of command arguments. Each entry carries a keyed hash (HMAC-SHA256) of itself and the one before it, with the key kept in the keychain, so lk log --verify finds an entry that was changed, removed or added, or a log cut short. It can't stop a program running as you from deleting the file, only show that it happened.
Guarantees and limits
Each mechanism, what it protects against, and what it doesn't promise.
| Mechanism | Protects against | Doesn't guarantee |
|---|---|---|
| Keychain storage | Values in plaintext files, backups and synced folders; values readable on a lost Mac | Safety after a value is released to a command |
| References | Secrets copied into config files and commits | Permission to read the item |
| Approval panel | Reads you didn't approve; shows the caller as macOS sees it | Control over what an approved command does next |
| Grants | Repeated prompts for a folder, for a time | Telling programs apart within that folder: any program asking from there is covered |
| Masking | Exact copies of a value in a command's output | Catching values that were encoded or transformed |
| Key proxy | The OpenAI or Anthropic key reaching the command | Limits on which calls the command makes with it; protection for other credentials |
| STS credentials | The long-lived AWS key reaching the command | Least privilege, which depends on the role's policy |
| Access log | Undetected edits, removals or truncation | A record of what the service saw, or protection against the file being deleted |
| iCloud Keychain | Values exposed in transit or at rest between your Macs | Safety from someone with your Apple Account and a trusted device |
| Shared items | Many copies of the same value | Separate authority per project |
Where protection ends
Read these before you rely on Latchkey.
- Anything running as you can ask. The socket is open to every process in your user account. Agent-safe items and grants are released to any program that asks from the right place, so keep them narrow and short.
- A released value is out of Latchkey's hands. A command can write it to a file, send it over the network or transform it. Masking only hides exact copies.
lk getprints the value. Keep agents away from it with your agent instructions or a hook that refuses it.- The same Mac account. Malware running as you could ask for approvals until you click one, or read a temporary key file while the command runs. Latchkey raises the bar; it doesn't replace a clean machine.
- History keeps old values for up to 30 days after deletion, or until there are more than 10 versions. Use Forget History when an old value shouldn't linger, and rotate leaked keys at the service either way.
- An exported file is a plain copy. Delete it when you're done, and keep it out of Git.
The full write-up is in the repository's docs/security.md, with the wire protocol and stored files described under References and API.
Reporting a problem
Privately, never in public.
Report a vulnerability privately: by email to latchkey@snackstud.io with "Security" in the subject, or through GitHub, in the repository's Security tab › Report a vulnerability. Please don't open a public issue for it. Include the Latchkey and macOS versions, what an attacker can do and what they need first, and steps to reproduce with example values only. Never send a real secret.
Stop being the credential courier.
Keep your projects, credentials and coding agents working together, with access you can inspect and control. Latchkey is free to download and use, and the core is meant to stay free. Pro will add more for a one-time price in the Mac App Store.