Give a sandbox a token without revealing it
A secret lets code in a sandbox call an API without ever seeing the credential. The guest gets a placeholder in an environment variable, and kumobad swaps in the real value only in HTTPS requests to the hosts you allow.
Before you begin, have a started sandbox in $id with network mode open or allowlist.
-
Set the secret:
kumoba set-secrets "$id" secrets='[{"name":"gh","value":"ghp_your_token","hosts":["api.github.com"],"envVars":["GITHUB_TOKEN"]}]'To keep the token out of your shell history, put the JSON in a file and pass
secrets=@secrets.json. -
Use it from the sandbox like a normal token:
kumoba exec "$id" -- sh -c 'curl -sS -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/user'Inside the guest,
$GITHUB_TOKENholds a placeholder such askmb_secret_…. The request toapi.github.comleaves kumobad with the real token. A request to any other host carries only the placeholder.
set-secrets replaces the sandbox's whole set; secrets='[]' removes them. kumoba delete-secrets --names gh removes a secret from every sandbox.
How secrets work explains the guarantees and limits.
Last updated on
Control network access
Control what a sandbox can reach with open, allowlist or blocked network modes, change the policy while it runs, read the access log, and reach intranets.
Run kumobad as a service
Run kumobad as a systemd service on a Linux server: explicit paths, clean shutdown, reverse proxy for preview links, TLS, intranets and corporate proxies.