Secrets
Get an API key into a run without putting it in your code.
A secret is stored encrypted, injected into a machine as an environment variable, and redacted from the logs. It never appears in your repository, your manifest, or your shell history.
Storing one
printf '%s' "$HF_TOKEN" | factor secret set HF_TOKENThe value is read from stdin, and there is no flag to pass it as an argument. That is deliberate: an argument lands in your shell history and is visible in the process list to every other user on the machine.
factor secret list # names and versions; never valuesfactor secret rm HF_TOKENUsing one
factor sandbox train.py --secret HF_TOKENsecrets:- HF_TOKEN- WANDB_API_KEYInside the machine they are ordinary environment variables:
import ostoken = os.environ["HF_TOKEN"]What the logs show
system | 1 secret(s) injectedsystem | running: [python train.py]stdout | the key is [REDACTED]The count is reported; the names and the values are not. Redaction happens on the machine before your process starts, rather than later in the log pipeline — a crash between those two points would otherwise ship the real value.
Per-run values
For something that changes per person or per machine and is not worth storing for the team:
factor sandbox train.py --env .env.localEncrypted and injected into that one run. Not stored as a team secret, not visible to anything else.
Rotating
printf '%s' "$NEW_TOKEN" | factor secret set HF_TOKENSame name, new version. Machines started from now on get the new value; anything already running keeps what it started with, because changing a variable underneath a running process is not something you can do safely.