Sandboxes never hold your keys
Code in a sandbox can now call an API as the user it works for without ever holding that user's key. Start the sandbox's tools with a placeholder such as GITHUB_TOKEN=placeholder, and set credential rules from your app:
await box.updateCredentials(sandboxId, [
{ host: "api.github.com", header: "Authorization", valuePrefix: "Bearer ", value: githubToken },
{ link: "api", header: "Authorization", valuePrefix: "Bearer ", value: turnToken },
])The egress gateway in the customer's environment replaces the header on the sandbox's matching requests. A host rule covers HTTPS to that exact host, through a CA of the sandbox's own. A link rule covers plain HTTP to a service the Sandbox links. The call returns once every gateway replica holds the new list, so the sandbox's next request uses it.
- Replace, not merge: each call sets the sandbox's whole list, and
[]removes every rule - Values stay out of reach: they live in gateway memory only, never in logs, metrics, errors, stack state, or the sandbox
- Within the egress policy: a rule never widens what the sandbox reaches
- Limits: 32 rules per sandbox, values up to 8 KiB, exact hostnames only
- Platforms: AWS, Azure agent images, Kubernetes, and Local, for Sandboxes declared
.egress("internet"). Python hasupdate_credentials.
Credential rules need the Alien CLI and SDK 3.3.76 or later.