A runner token leaked through a command line
I revoked it in the database right away and issued a new one.
I was setting up a Gitea Actions runner and needed to store its registration token in Infisical.
Two things happened.
First, the Gitea admin API endpoint for a registration token returned 404 on Gitea 1.27.0. Running the CLI inside the pod worked:
kubectl exec -n gitea deploy/gitea -- gitea actions generate-runner-tokenSecond, the mistake. A Python one-liner passed the token to a helper script as a command-line argument. The helper script path was wrong. Python raised CalledProcessError, and the error printed the whole command, token included, to the terminal.
A token on a command line can show up in error messages, process lists and shell history. This one showed up in an error.
What I did right away:
- Deleted the token in Gitea’s database:
DELETE FROM action_runner_token;(it returnedDELETE 1). - Generated a new token with the CLI.
- Passed the new one only through environment variables, never on a command line.
- Synced it to my Infisical instances.
From now on, secrets go in through stdin, environment or a file. Never argv.
Recipes written later from this work: