Secrets
A secret is a named value — a database URL, a token — stored encrypted on your account and handed to the machines you bind it to. Each command on such a machine gets it as an environment variable of the same name. You never paste it into a script, and it never appears in a command, a log or the Activity log.
There are two kinds:
| Custody | The machine gets | Use it for |
|---|---|---|
| Box (default) | The value itself — code on the machine can read it | Things that must be local: a database URL, a signing key |
| Proxy | A placeholder; the value is swapped in on HTTPS to the hosts you name | API keys that must not leak even to hostile code — see Proxy secrets |
The rest of this page applies to both, except where it says box.
Create one in the dashboard
Section titled “Create one in the dashboard”Secrets in the sidebar → enter a name and a value → Save secret.
The value is write-only. Nothing — the dashboard, the API, an error message — ever shows it again. To change it, rotate it; to see it, you cannot.
Creating, rotating and deleting are dashboard only. An API key can list secrets and bind them by name, but cannot create, change or delete one, so a leaked key cannot plant or replace a credential.
| Rule | |
|---|---|
| Name | A–Z, 0–9 and _, not starting with a digit, up to 64 characters. It is also the variable name |
| Reserved names | PATH, HOME, USER, SHELL, PWD, LANG, TERM, HOSTNAME, IFS, and anything starting SISTEMO_ or LD_ |
| Value | Up to 8 KiB, no NUL byte |
| Per account | 50 |
Bind it to a machine
Section titled “Bind it to a machine”At create:
curl -sS -X POST https://api.sistemo.io/v1/machines \ -H "Authorization: Bearer $SISTEMO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"stack":"python","secrets":["API_TOKEN"]}'Or later, on any machine you own:
curl -sS -X POST "https://api.sistemo.io/v1/machines/$MACHINE_ID/secrets" \ -H "Authorization: Bearer $SISTEMO_API_KEY" \ -H "Content-Type: application/json" \ -d '{"bind":["STRIPE_KEY"],"unbind":["API_TOKEN"]}'Both return the machine, whose secrets field lists the names bound to it. Then
use it like any variable:
curl -sS -H "Authorization: Bearer $API_TOKEN" https://api.example.com/v1/ordersIn the dashboard, each machine has a Secrets tab for the same thing.
From the SDKs (0.2.0 and later): Sandbox(network="locked", allow=[…], secrets=[…]) in
Python, Sandbox.create({ network, allow, secrets }) in JavaScript — see
Python and
JavaScript.
The web terminal gets no secrets, by design — they reach commands only, so a secret is never sitting in an interactive shell’s environment.
When a change takes effect
Section titled “When a change takes effect”| You | The machine |
|---|---|
| Bind or unbind | The next command sees the change. A command already running keeps the environment it started with |
| Rotate | Box: bound machines get the new value on their next command — no restart. Proxy: running machines get it before the rotate returns — see Proxy secrets |
| Delete | Refused (409) while the secret is bound anywhere; the message names the machines. Unbind first |
The machine can read it (box custody)
Section titled “The machine can read it (box custody)”A bound box secret is in the environment of every command on that machine, so any code you run there can read it — and so can anyone holding a full-scope API key, because such a key can bind the secret to a machine and print it. Treat binding as handing the value over.
If that is not acceptable for a credential, make it a proxy secret: the machine never holds the value.
What limits the damage for a box secret:
- Lock the machine’s network. With a locked network, code that reads the secret can only send it to the hosts you allowed. Bind a payment key to a machine that can reach the payment API and nothing else. A locked machine speaks HTTP and HTTPS only, so a database URL needs an open machine.
- Bind narrowly. Only the machines that need it, only for as long as they do.
- Watch the Activity log. Every bind and unbind is recorded as
secret.bound/secret.unboundwith the secret’s name (never its value). A bind you did not make is the thing to look for. - Use read keys for automation that only watches. A read key cannot bind.
Rules worth knowing
Section titled “Rules worth knowing”- Up to 16 secrets per machine.
- An unknown name is a
400before anything is created — a typo never gives you a machine without its credentials. envcannot shadow a secret. A command whose ownenvsets a name that is also bound is refused with a400, rather than one of the two silently winning.- Bindings belong to the machine. A machine created from a preserved disk or a snapshot starts with none; bind again.
Related
Section titled “Related”- Proxy secrets — a credential the machine can use but never read
- Locked network — limit where a machine, and its secrets, can go
- Secrets API — every route and status code
- Activity log — the
secret.*entries