Secret stores
To register a secret, give its name and one flag that names its source. For every source but --env and --file, Pandra reads the value once, so a command that succeeds also shows that the store works from where you run Pandra:
$ pandra config secret set slack-token --1password op://Work/Slack/token
registered secret slack-tokenEach source takes its own flag:
| Source | Flag | What it needs | When it fails |
|---|---|---|---|
| 1Password | --1password op://VAULT/ITEM/FIELD | op on PATH, signed in (or OP_SERVICE_ACCOUNT_TOKEN) | op signin |
| Bitwarden | --bitwarden ITEM[/FIELD] | bw on PATH, an unlocked vault in BW_SESSION | bw unlock, or bw login |
| OS keychain | --keychain | An unlocked keychain; on Linux, GNOME Keyring or KWallet | Unlock it with the system's tools |
| AWS Secrets Manager | --aws-secrets-manager ARN | Credentials from AWS's standard chain | aws sso login --profile ... |
| Environment variable | --env VAR | The variable set where Pandra runs | Export it |
| File | --file PATH | A readable file | Create or mount it |
| Command | --command CMD | A command that prints the value within 30 seconds | The error shows its standard error |
An --env variable that is not set, or a --file that does not exist, is registered with a warning, because such values are often set only where runs happen, such as in CI. The keys each source writes under [secrets.NAME] are in the config.toml reference.
Manage secrets
pandra config secret list lists each secret with its store and where the value is; --json adds each secret's line in the file:
SECRET STORE REFERENCE OVERRIDE
claude-work-token keychain pandra/claude-work-token set
github-token command gh auth token -
slack-token 1password op://Work/Slack/token -OVERRIDE says whether a PANDRA_SECRET_<NAME> variable supplies the value. pandra config secret set with an existing name changes its source. pandra config secret remove NAME removes a secret that nothing refers to, and never deletes the value from its store.
Secret values are never command-line arguments, so they stay out of shell history and process listings: --secret always names a logical secret. Pandra writes a value only to the OS keychain; for every other store, save the value with the store's own app or CLI first, then register where it is.
1Password
--1password takes a full secret reference: op://VAULT/ITEM/FIELD, or op://VAULT/ITEM/SECTION/FIELD for a field in a section. In the 1Password app, a field's "Copy Secret Reference" gives it. With op and jq:
# Sign in
op signin
# Find the reference: list the items of a vault, then the references of an item's fields
op item list --vault Work
op item get Slack --vault Work --format json | jq -r '.fields[].reference'
# Register the secret
pandra config secret set slack-token --1password op://Work/Slack/tokenWhen several accounts are signed in and op cannot choose, add --account ACCOUNT. In CI, a service account token in OP_SERVICE_ACCOUNT_TOKEN works as it does for op.
Bitwarden
--bitwarden takes an item's name, alone or with one of its fields:
| Reference | Reads |
|---|---|
Item | the item's password |
Item/username | its username |
Item/notes | its notes |
Item/uri | its URI |
Item/totp | its current TOTP code |
Item/FIELD | its custom field named FIELD, which must match the field's name exactly, including case |
Neither the item's name nor the field's can contain /, and an item name that several items share is an error from bw; rename one of them. With bw and jq:
# Sign in and unlock the vault, in the shell you run Pandra from
bw login
export BW_SESSION="$(bw unlock --raw)"
# Find the reference: list the names of matching items, then an item's custom field names
bw list items --search context7 | jq -r '.[].name'
bw get item context7 | jq -r '.fields[]?.name'
# Register the secret
pandra config secret set context7-api-key --bitwarden context7/api-keyA field name that the item does not have fails with an error that names the field and the item; list the item's field names as above to find the right one:
error: secret "context7-api-key" (Bitwarden context7/foo): the tool that reads Bitwarden failed: Bitwarden: invalid response: Custom field 'foo' not found in item 'context7'Pandra never asks for your master password: when the vault is locked, the error gives bw unlock to run. Bitwarden Secrets Manager (bws) is not a store.
Security
While bw reads a value, the session from BW_SESSION is in its command line, where other processes on the machine can read it.
The OS keychain
--keychain uses the entry with service pandra and the secret's name as its account: your default keychain on macOS, and the Secret Service, such as GNOME Keyring or KWallet, on Linux. It is the one store Pandra writes, so there is no reference to find:
# Sign in: unlock the keychain with the system's tools, such as on macOS
security unlock-keychain
# Register the secret, and store its value
pandra config secret set claude-work-token --keychainWhen the entry is empty, or with --replace, Pandra asks for the value with a hidden prompt, or reads it from standard input without a terminal:
$ pandra config secret set claude-work-token --keychain
✓ Value for secret claude-work-token: ********
stored 108 characters in the keychain; registered secret claude-work-tokenPandra never unlocks a keychain: a locked one is an error. An entry another tool wrote can be named in the file, as keychain = { service = "...", account = "..." }; on macOS, security find-generic-password -s SERVICE -a ACCOUNT shows whether the entry exists. A Linux server or container usually has no Secret Service, so use another source there. pandra config secret remove keeps the keychain entry; delete it with Keychain Access, security delete-generic-password, or secret-tool clear.
AWS Secrets Manager
--aws-secrets-manager takes the secret's ARN, as the AWS console copies it, or its name with --region. --json-key KEY takes one top-level key of a secret stored as a JSON object, and --profile selects an AWS profile. With the aws CLI:
# Sign in
aws sso login --profile work
# Find the reference: list the ARNs of your secrets
aws secretsmanager list-secrets --profile work --query 'SecretList[].ARN' --output text
# Register the secret
pandra config secret set github-token --profile work \
--aws-secrets-manager arn:aws:secretsmanager:us-east-1:123456789012:secret:ci/github-token-AbCdEfPandra reads the current version (AWSCURRENT), with credentials from AWS's standard chain.
Environment variables
--env VAR reads a variable from the environment Pandra started with:
pandra config secret set github-token --env GITHUB_TOKENAgents also inherit that variable from your shell, except in a run whose target's credential reads it. To give Pandra a value that agents must not see, use PANDRA_SECRET_<NAME> instead, which Pandra always removes.
Files
--file PATH reads the file at the start of each run that needs it, with one trailing newline removed. It suits mounted secrets, such as /run/secrets/ in Docker and Kubernetes:
pandra config secret set slack-token --file /run/secrets/slack-tokenCommands
--command CMD runs sh -c CMD once at the start of a run that needs the secret and uses its standard output:
$ pandra config secret set github-token --command "gh auth token"
ran `gh auth token` (40 characters); registered secret github-tokenThe command runs in the directory that holds the configuration file, with no standard input, so a command that wants you to log in fails instead of waiting:
error: `gh auth token` failed (exit 1), so secret "github-token" could not be read
gh: no oauth token found for github.comOnly you define a command: pandra config setup --file refuses one, and a package never defines secrets. A token that expires during a long run is not refreshed.
How Pandra reads 1Password, Bitwarden, and AWS
Pandra reads these three stores through fnox, a tool it downloads on first use and checks against a digest built into Pandra. That first read needs the network, so with --offline it fails until fnox is downloaded. To use your own fnox binary, set [fnox] path (config.toml).