Keeping secrets out of scripts
Startup scripts are stored with your reservation. Here's how to use tokens and keys without putting them in one.
Every startup script editor carries this warning:
This script is stored with your instance. Be mindful about API keys, tokens or passwords in it.
A startup script is saved as plain text with your reservation, and kept with it after the reservation ends. Anything in the script — including a Hugging Face token, a cloud access key or a password — is stored too. Treat a script like a file you might share, not like a password manager.
Do this instead
Log in and set the secret for your session. Once you're connected, export it in your shell. It exists only on the machine, only until the reservation ends:
read -rs HF_TOKEN && export HF_TOKEN # paste the token; it isn't echoed
~/.venvs/mlx/bin/hf download meta-llama/Llama-3.3-70B-InstructUse a tool's own login. Many CLIs store credentials in your home directory on the machine, which is wiped at the end of the reservation:
~/.venvs/mlx/bin/hf auth loginCopy a credentials file over SSH when you need one, rather than pasting its contents into a script:
scp ~/.config/my-tool/credentials.json gtl:~/.config/my-tool/Let the script do everything that doesn't need a secret. Install packages and download public models in the startup script; do the rest by hand.
If you must use a token in a script
Sometimes a download has to start before you log in. If you put a token in a script:
- use a fine-grained, read-only token with access to just what the script needs,
- give it a short expiry, and
- revoke it once your reservation has ended.
What happens to your data
When the reservation ends, the machine is wiped, including any secrets you exported, logged in with or copied over. See Reservation lifecycle and our Privacy Policy.