Skip to content
Mementropy
Lab NotesHomelab notebookField note

A runner token leaked through a command line

I revoked it in the database right away and issued a new one.

By Ryan Hammang

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:

Terminal window
kubectl exec -n gitea deploy/gitea -- gitea actions generate-runner-token

Second, 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:

  1. Deleted the token in Gitea’s database: DELETE FROM action_runner_token; (it returned DELETE 1).
  2. Generated a new token with the CLI.
  3. Passed the new one only through environment variables, never on a command line.
  4. 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: