Documentation · Usage · In the app

Exchange tokens and CLI sessions

Two ways to let a program read your credentials: an exchange token you create for one application, and a CLI session from signing in with your browser. When to use which, and how to end them.

Which one to use

Where the program runsUseWhy
Your laptop, when you are thereA CLI sessionNothing to store; you approve in the browser and it ends by itself
A script, cron job or agent with no platform identityAn exchange tokenNo one is there to approve a login
A CI job, a pod or a cloud functionNeither: a trust policyThe platform's own identity token; nothing is stored at all
Something a team owns, not youAn identity's exchange token or trust policy, from an adminIt keeps working when you leave

Exchange tokens

Create one

  1. On Exchange tokens, choose Create a token.
  2. Application: what will use it, for example nightly-backup. It names the token in Used by and the audit log.
  3. Credentials it may read: only the specs it needs.
  4. Valid for (hours): as short as the job allows. The form shows the most your admins allow (30 days unless they changed it).
  5. Copy the token from Token created. It is shown once and not stored.

The dialog also shows how to read with it:

TOKEN='cst_...'
curl -s -H "Authorization: Bearer $TOKEN" https://credvane.example.com/api/v1/credentials/github-packages

The answer is JSON with the current value in value. This lists what the token can read:

curl -s -H "Authorization: Bearer $TOKEN" https://credvane.example.com/api/v1/credentials

Or with the command line, from a cron job:

# /etc/credvane/backup.token holds the token, readable only by the backup user
CREDVANE_URL=https://credvane.example.com \
  credvane run --token-file /etc/credvane/backup.token s3-backup=AWS_SECRET_ACCESS_KEY -- ./backup.sh

Pros and cons

Good

  • Works anywhere that can make an HTTPS request.
  • Limited to the specs you list, and it expires.
  • Each read shows under Used by on the credential, named after the application.
  • The value it reads is always the current one, so rotating the credential needs no change to the program.

Watch out

  • It is itself a secret: store it like one, readable only by the program.
  • It reads your credentials. When you leave and are offboarded, it stops working; for something a team depends on, ask an admin for an identity.
  • It expires: create the next one before it does. You are emailed 14 and 3 days before.
  • If it leaks, revoke it; an admin can trace a leaked cst_ value on Leaks.

Manage them

The list shows each token's application, the credentials it may read, when it expires, when it was last used and its status. Revoke ends one at once. A token never used, or not used for a long time, is a good one to revoke.

CLI sessions

credvane login --url https://credvane.example.com
credvane run github-packages=NPM_TOKEN -- npm publish

credvane login opens Credvane in your browser; check the machine name and approve. The session is kept in your system keychain and lasts 12 hours unless your admins set it shorter. See the command line for everything it can do.

Good

  • Nothing to create, copy or store by hand.
  • Short-lived, and ends at once when you are deactivated.
  • Never longer than the longest exchange token your admins allow.

Watch out

  • It reads every credential you hold, not a list: fine for you at your desk, too broad for an unattended job.
  • It needs you to approve in a browser, so it cannot start a job by itself.

The CLI sessions list on the Exchange tokens page shows each session's client, when it signed in, when it ends and when it was last used. End one you no longer use, or that you do not recognise.credvane logout ends the one on your machine.

For identities

Admins create exchange tokens for an identity on its Exchange tokens tab. Such a token reads the identity's credentials and does not depend on any one person.