CommonRig docsOpen the app

Docs / Secrets and data / Passwords and keys

Passwords and keys

Your keys live in your password manager, and your agent runs a command that fetches one at the moment it is needed. The one thing CommonRig keeps is a key an integration here needs to run, entered once and kept encrypted: see Integrations and keys.

Why keys never go in

Your agentYour machineOutsideserviceRuns the wrappersuch as op run or bwsrunPassword managerunlocks the valueCommand startskey in itsenvironment onlySees the outputnever the keyYour agentYour machineOutside serviceRuns the wrappersuch as op run or bwsrunPassword managerunlocks the valueCommand startskey in itsenvironment onlySees the outputnever the key
Your agent runs a wrapper; the key goes from the manager to the command and nowhere else
  • A key written into CommonRig would sit in a hosted store, in your nightly repo copy and in your agent's context. In a manager, it sits in none of them.
  • Anything you paste that looks like a key is masked on the way in.
  • You can say where a key lives, in a credential record or in plain words, but never its value. The one exception is a key an integration on our side needs, such as a webhook's signing secret: Integrations and keys.

Three managers side by side

1PasswordBitwarden Secrets ManagerHashiCorp Vault
A reference looks likeop://Dev/OpenRouter/credentialA secret idsecret/data/myapp, field api_key
Run a command with keysop run --env-file .env -- <command>bws run -- '<command>'vault kv get into the command, or Vault Agent
On a machine with nobody thereA service account tokenA machine account access tokenVault Agent with its own sign-in
Good forPeople who already use 1PasswordTeams wanting a free tier for machinesSelf-hosted, long-running services

1Password

Put a reference in an env file, never the value. op run swaps each reference for the real value in the command's environment only.

.env (reads op://<vault>/<item>/<field>)
OPENROUTER_API_KEY=op://Dev/OpenRouter/credential
Run
op run --env-file .env -- npm run start

Headless, with no person to unlock the app: create a service account and set OP_SERVICE_ACCOUNT_TOKEN in that machine's environment. op run then works the same. Docs: developer.1password.com/docs/cli/secrets-environment-variables.

Bitwarden Secrets Manager

A machine account gets an access token that reaches only the projects you give it. bws run puts each secret in the command's environment under the secret's name.

Authenticate: in that machine's environment
BWS_ACCESS_TOKEN=<the machine account token>
Run, every secret the account reaches
bws run -- 'npm run start'
Run, one project only
bws run --project-id <project id> -- 'npm run start'

bws secret get <secret id> prints a JSON object with the value in it, so prefer bws run. Flags change between versions: check bws --help. Docs: bitwarden.com/help/secrets-manager-cli.

HashiCorp Vault

Secrets live at a path in the key-value store. Read one field on demand, or have Vault Agent write it for a long-running service.

One field, no trailing newline, so it pipes cleanly
vault kv get -mount=secret -field=api_key myapp
Vault Agent template block contents, rendered to a file your service reads
{{ with secret "secret/data/myapp" }}{{ .Data.data.api_key }}{{ end }}

Vault Agent re-renders the file as the secret changes. For an environment variable instead, use an env_template block in process supervisor mode. Docs: developer.hashicorp.com/vault/docs/agent-and-proxy/agent/template.

Checked against the code at e28af69c. Site built from f04f4af1.