S15-03 - Access Rules
Purpose: How each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item.
Design
Section titled “Design”Access rules
Section titled “Access rules”-
Declared. Each process has a declared set of items, in the table of “Declared access” below. Each has an access kind:
- write;
- delete;
- fetch: the value comes into the process;
- list: item names only, never a value;
- use: the store or the hardware key store signs or decrypts in place, and keeps the key.
Our code refuses an undeclared access where the backend can’t, and logs it with the rule
store-access-undeclared. -
Use over fetch. Where the store can use a key in place, the process doesn’t fetch it, as with 1Password’s SSH agent signing after V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there.. For the CA key,
wb-proxydfetches only the key’s wrapped form. The Secure Enclave or the TPM signs with it, so the key itself never enters the process (S09-06-ca-keysS09-06-ca-keys: CA KeysHow the key of each TLS inspection certificate authority is made, stored and restored, and when a CA is valid., “Key”). -
Just in time, sized to the need. A process fetches when the work starts. It keeps the value in memory only, and drops it when the work ends. Go and Swift can’t reliably wipe memory, so the bound is the work’s end, or the process’s exit.
-
Few prompts. A session start fetches every item it needs in one batch, so a 1Password unlock after V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there. asks at most once.
wb-proxyddoesn’t fetch per request. A store prompt is never an approval, and is never shown in the agent’s terminal (SEC14-no-fake-approvalsSEC14-no-fake-approvals: Approvals cannot be spoofed by the guestApproval prompts are never rendered in the agent's terminal stream., I51I51 (closed): S09-policy-credentials-audit: approval flow, what the blocked client sees, and approval noiseS07-egress-gateway and S09-policy-credentials-audit describe approval choices and their security (SEC14-no-fake-approvals), not how the flow behaves.). The Keychain doesn’t show a dialog in any build (“No Keychain dialogs” below). -
Consumers that can’t read the store. A program that can’t read the store itself, such as
wb-vmdorwb-build-ssh, gets the value from a declared reader on a pipe or on standard input. It never gets it in arguments, the environment, a file, a log line, a gRPC message field, an audit record, or an error message. A process that only passes the descriptor on never reads it.The same rule applies to a value that is to be written to the store.
wbreads it from a prompt or its own standard input. It writes it towb-credset’s standard input, and keeps it in memory only until that write ends. It never fetches it back. -
Audited without the value. Each fetch, use, list, write and delete is an audit record with the process, the item name, and the access kind (SEC10-auditSEC10-audit: AuditEvery egress decision, approval, and returned change is recorded on the host in a persisted log the guest cannot alter.).
-
Locked means closed. Session start, warm start, builds, and rotation wait for the user to unlock a locked store. They say which store they wait for. Nothing falls back to another place.
A read that fails because the store is locked is this case, in every build and on every backend. That is -25308 on the Keychain, or a locked 1Password after V1V1-initial: Initial versionThe first version: what it delivers, what it leaves out, and the milestones that get there.. It holds for a CA item too (S09-06-ca-keysS09-06-ca-keys: CA KeysHow the key of each TLS inspection certificate authority is made, stored and restored, and when a CA is valid., “Valid CA”).
-
Generated items are named and removed. A secret Wraith Box generates is random, from the OS’s cryptographic random source. It is named for what it belongs to, and removed with it. At start, when each build ends, and when a system disk is replaced,
wb-hostdstartswb-guestadmin-cleanup. That removes the items of builds, images and disks that are gone, and logs each.A build ends, passed or failed, when
wb-hostdhas deleted its build bundle (S06-02-image-buildS06-02-image-build: Image BuildHow wb image build makes a guest image: the build VM, its two provisioning stages, terminfo, sealing, and storage., “The build bundle”).wb-hostdstarts the cleanup then, and that run removes the build’swbadmin/build/<build>item. The item lasts no longer than its build (SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts.). When that run fails or is killed,wb-hostdlogs the failure with the rulecleanup-failedand keeps running. The next run, at the next build end, disk replacement or start, removes the item. The run at start also removes what a crash left. -
Into a guest only before project code. A credential that opens anything outside one VM never enters a guest, which gets a placeholder. A
wbadminpassword opens nothing outside its own VM, so it isn’t a host secret (SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential.). It enters its own VM only at first contact, before project code runs.
No Keychain dialogs
Section titled “No Keychain dialogs”Every process with store access calls
SecKeychainSetUserInteractionAllowed(false) before its first store
call. A read that would ask then fails at once instead
(X09-keychain-unsignedX09-keychain-unsigned: Keychain access without a signing identityConfirm the fallback access-control model from S09-policy-credentials-audit and the Secure Enclave key creation for an ad-hoc signed binary.).
The call is deprecated and applies to the whole process. A process
that can’t make it doesn’t touch the store, and logs the rule
store-dialogs-on.
Declared access
Section titled “Declared access”Item names start with wraithbox/. Each <…> part is 1 to 64
characters of a to z, 0 to 9 and -.
| Item | Process, access | Channel to the consumer | Lifetime |
|---|---|---|---|
binding/<name> |
wb-credset, write (wb cred set) |
the value from wb, on wb-credset’s standard input |
one run |
binding/<name> |
wb-credset, delete (wb cred rm) |
none | one run |
binding/<name> |
wb-credset, list (wb cred list): names only, no value is fetched |
the names, on its standard output to wb |
one run |
binding/<name> |
wb-proxyd, fetch, the bindings of the VM’s sessions |
sent to the binding’s hosts over TLS checked against system roots, per request | while a session that needs it runs in the VM, dropped at suspend |
binding/<name>, OAuth |
wb-proxyd, fetch, and write the refresh token |
the token endpoint the binding names, over TLS | per exchange. Access tokens stay in memory |
ca/<vm>/<ca>, the wrapped CA key (macOS, every build, and Linux with a TPM) |
wb-proxyd, write when it issues the CA, fetch, delete |
to the Secure Enclave as the key’s token object ID, or to the TPM as its key blob. The value is useless on another host | the CA’s life. wb-proxyd deletes it when the CA expires or is dropped (S09-07-ca-certificatesS09-07-ca-certificates: CA CertificatesThe profile and scope of each TLS inspection CA, the leaf certificates it signs, and its rotation., “Lifetimes”) |
| CA signing key (macOS, Windows, and Linux with a TPM) | wb-proxyd, use: through the wrapped key, or on Windows by its name in the platform crypto provider. On Windows also delete, of the named key, from the removal list below |
none: the key stays in the Secure Enclave or the TPM | the CA’s life |
ca/<vm>/<ca>, the software key (Linux hosts without a TPM only) |
wb-proxyd, write when it issues the CA, fetch, delete |
none: it signs in wb-proxyd |
the CA’s life, deleted as above |
wbadmin/build/<build> |
wb-guestadmin-build, write, then fetch. wb-guestadmin-rotate, fetch at the build VM’s first contact |
a pipe to the build’s wb-vmd (until the start call returns), wb-build-ssh’s standard input (one session), the guest connection of S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact. |
removed when the build ends |
wbadmin/image/<image> |
wb-guestadmin-rotate, write at the build VM’s first contact, fetch at each VM’s first contact |
the guest connection of S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact. | removed with the image |
wbadmin/image/<image> of a parent, and of the image built on it |
wb-guestadmin-rotate, at the layer VM’s first contact only: fetch of the parent’s item, and write of the new image’s item. It writes no VM item there |
the guest connection of S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact. | the parent’s item is removed with the parent (S06-01-image-layersS06-01-image-layers: Image Layers and the Toolchain PrefixThe layers of a guest image, and the toolchain prefix that project layers install into., “Parents”). The new image’s item is removed with that image, or by wb-guestadmin-cleanup when its build fails |
wbadmin/vm/<vm>/<disk> |
wb-guestadmin-rotate, write at first contact |
the guest connection of S15-04-guest-adminS15-04-guest-admin: The Guest Admin UserHow the host keeps the password of the guest admin user wbadmin, from the image build to each VM's first contact. | kept for the secure token and a later diagnostics path (I158I158 (open): S15-least-privilege: developer break-glass through recoveryOS with a disabled wbadminCan the host boot a macOS VM into recoveryOS (VZMacOSVirtualMachineStartOptions, startUpFromMacOSRecovery), authenticate there as the volume owner wbadmin with its host-held password, and get a root Terminal on the…), removed when the system disk is replaced |
wbadmin/build/<build>, wbadmin/image/<image>, wbadmin/vm/<vm>/<disk> |
wb-guestadmin-cleanup, delete of the items of builds, images and disks that are gone (rule 8) |
none | one run |
Which wbadmin item is current for a disk isn’t secret. So wb-hostd
keeps that marker in state.db, and never stores a value.
Removing CA keys
Section titled “Removing CA keys”When a CA expires or a VM is deleted, wb-hostd moves the names of
its CA keys to a removal list in state.db. Those are the items, or
on Windows the named keys. A dropped CA’s items go on the same list.
wb-proxyddeletes each listed item when it runs, and at its next start when it doesn’t.wb-hostddrops an entry oncewb-proxydreports it deleted.
An item that is already gone counts as deleted. On Windows the named
key’s name in the platform crypto provider is the item name
ca/<vm>/<ca>.
wb-proxyd checks each batch before it deletes anything:
- every entry must have the form
ca/<vm>/<ca>, with the parts of “Declared access”; - its CA must not be in
wb-hostd’s record.
Otherwise wb-proxyd refuses the batch with the rule
ca-removal-refused. It logs each entry that failed, and deletes
nothing from that batch. wb-hostd then removes the entries refused
for their form from the list, and logs that. An entry refused because
its CA is in the record stays, logged, and waits for that VM’s next CA
set. wb-hostd sends the others in the next batch, so one refused
entry doesn’t hold back the rest.
- The form check is what limits a compromised
wb-hostd(T16-hostd-landingT16-hostd-landing: A compromised `wb-hostd` decides what `wb land` brings inwb-hostd faces the guest, and it may read every project's export.git and write every project's landing.git (S04-03-self-sandboxing, "Each host daemon is self-sandboxed").), which faces the guest. - The record check uses
wb-hostd’s own record, so it catches bugs.
Through the list, a compromised wb-hostd can at worst delete live CA
key items. That costs availability: the VM’s start is then refused
with ca-key-restore.
Passwords in remote URLs
Section titled “Passwords in remote URLs”A password in a host remote URL isn’t a store item. wb removes the
user name and password from every remote URL it reads, withheld ones
included. It does that before the URL goes anywhere, the audit log
among them (S08-01-into-the-guestS08-01-into-the-guest: Into the GuestHow the project's code reaches the guest: the clone, its transport, its remotes, and the uncommitted changes carried in at session start., “Remote URLs”).
Status: Draft