Keep tokens and passwords out of saved files¶
Draft: not yet validated
These steps were followed once inside MESA JupyterLab on 2026-11-16, by the AI assistant that drafted them, with the notebook saved by its keyboard shortcut. No person has yet followed them, so a screen may differ. Tell us what you find.
A notebook file stores every cell and every output. A token typed into a cell, or printed by one, is saved with the notebook and goes wherever the notebook goes: your Data Store, a shared folder, a Git repository.
You will: have used a token in a notebook that does not contain it.
Time: 5 to 10 minutes. You need: practice.ipynb from
Load a file from your Data Store into a notebook, open in
MESA JupyterLab. You will use a made-up token, not a real one.
Steps¶
-
In a new cell, run:
from getpass import getpass token = getpass("Token: ")You should see: a box labelled Token: under the cell.
-
Type
not-a-real-tokeninto the box and press Enter.You should see: a dot for each character as you type, then a short row of dots beside Token:. The dots are a placeholder, not your token. The value is in memory as
token; it is not in the cell and not in the output. -
Confirm the notebook received it, without displaying it:
len(token)You should see:
16. -
Choose File → Save Notebook.
You should see: the dot on the notebook's tab disappear.
-
Count how many times the token appears in the saved file:
open("practice.ipynb").read().count(token)You should see:
0. -
Remove it from memory when you have finished:
del tokenYou should see: no output. Restarting the kernel does the same.
Check it worked¶
Step 5 returns 0: the saved notebook does not contain the token, although the
notebook used it.
If it didn't¶
Step 5 returns 1 or more. The token was typed into a cell or shown in an output,
for example by running token or print(token). Delete that cell, choose
Edit → Clear Outputs of All Cells, save, and run step 5 again. If it had been a
real token, clearing it would not be enough: replace the token with a new one at the
service that issued it, because earlier copies of the file may still hold the old one.
Next¶
- The MESA sign-in commands follow the same rule:
cyverse-loginandaiverde-setupask for your password or key and keep it outside your Data Store. See Sign in and start an AI agent in a MESA app. - Reference: Credentials in the MESA documentation, which says where each MESA tool stores a password, and getpass.
Not yet validated by a person in MESA JupyterLab. Drafted with AI assistance on 2026-11-12 and followed once there on 2026-11-16.
Machine-readable versions of this page: Markdown twin · raw source on GitHub · llms.txt · llms-full.txt (whole site). See For AI agents.