Guest Secrets
A secrets bundle is a list of {path, value, mode} entries in the requester's vault, named by the contract's spec.secretsRef. The guest fetches the bundle after boot. Secrets never appear in VM user-data, in a market record in the clear, or in logs.
The guest tries three delivery routes in order. Server to server, the peer transport is iroh, so a requester with an iroh listener does not open a WebRTC channel for secrets. WebRTC is reserved for requesters that cannot listen on iroh (such as those without a pipe binary, or a browser).
| Route | When |
|---|---|
| 1. Peer transport | The requester gave the guest a peer address |
| 2. HTTPS | The requester has an HTTPS ingress |
| 3. Sealed record | The requester takes no inbound connection, and the guest asked |
Contents
- Workload Identity
- Route 1: Peer Transport
- Route 2: HTTPS to the Requester
- Route 3: Sealed Record
- Routes by Requester
- Guest Setup
- References
Workload Identity
Every route starts with the bidder's identity service issuing the guest a short-lived workload identity token for the requester's audience. The requester checks the token's issuer, audience, and subject on every fetch:
Route 1: Peer Transport
When the requester provides a peer address, the guest fetches the bundle over the peer link:
The guest agent holds the peer link and exposes it as a local socket for the fetch, and iroh traffic goes through our relay, https://iroh.socialweb.computer. The requester runs an iroh listener only while one of its contracts has a secretsRef. If the listener has no address after 60 s, the guest gets HTTPS alone. If neither route is available, the contract fails with no secrets channel.
Route 2: HTTPS to the Requester
If the peer link returns no bundle and the requester has an HTTPS address, the guest falls back to HTTPS:
The guest tries route 1 and then route 2 for up to 10 rounds, 5 s apart (the loop is in internal/atproto/cloudinit/modules.go, and the numbers are in guestsecrets.go).
Route 3: Sealed Record
When the requester takes no inbound connection (comms mode Firehose) and its secretsFallback is Sealed, the guest requests a sealed bundle through market records:
This route is never used if the requester has any inbound endpoint. The requester sends a sealed bundle only after the guest asks, never unasked. The bidder relays the ciphertext (at most 65536 bytes) and cannot open it.
Routes by Requester
Which route a contract uses depends on the requester:
| Requester | Route |
|---|---|
CLI run request | iroh, then HTTPS |
| Any Go requester with no pipe binary | WebRTC, then HTTPS |
| k8s gateway (cluster nodes' join credentials) | iroh, then HTTPS |
| ssh gateway (a paired account's co/core key) | iroh, then HTTPS where the gateway has an HTTPS ingress (prod has none) |
| Browser page | Sealed record |
Requesters are wired up in four places, and all four get the iroh route through one shared function: internal/app/marketrequester, internal/app/gateway, and internal/app/sshgateway (its own requester plus one per signed-in account).
Guest Setup
Every path in the bundle must be clean and absolute. Only missing directories are created (0700, owned by root), and each entry's mode is honored with a default of 0600. If any entry is refused, the whole bundle is refused and nothing is written. setup-secrets.service runs once, and units that need the secrets start after it.
References
On the requester side, ensureSecrets and getSecrets live in internal/market/requester/secrets.go, and the sealed record path is in guestsecrets.go. Look for requester_guest_secrets_fetched ... channel <iroh|webrtc|https> and requester_guest_secrets_sealed in the requester logs.
On the guest side, secrets are applied by /usr/local/bin/setup-secrets.sh and logged under journalctl -u setup-secrets. The contract reports the SecretsApplied condition with reason GetSecretsIroh, GetSecretsWebRTC, GetSecretsHTTPS, or SealedFallback.
The design rationale is recorded in plan 0040 decision 64 (peer transports first) and plan 0060 (the ssh gateway, where server to server is iroh).