Setup guide
Credential helpers
Let git, Docker, the AWS CLI and kubectl log in with a granted credential through bpw's credential helpers, inside an agent session.
Status: P4-7 (ADR 0045), built from source. This guide lets git, Docker, the AWS CLI and SDKs, and kubectl log in with a credential you granted, through each tool’s own credential-helper mechanism. The token is fetched from the daemon each time the tool needs it and is never written into the tool’s config.
Read this first: every helper grant is disclosing. The helper hands the value to the tool, and the tool runs where the agent works, so the agent, or code it runs, can read that value. That is why a cli_login grant needs --allow-disclosure (“this agent can read this secret”). Prefer http_request for API calls; use a helper when the tool itself must log in.
How it works
- You add the credential and a
cli_logingrant naming each tool and host it may log in to. Only you can make a grant, with your master password. - You, or your agent, point the tool at its helper (
bpw login <tool>prints how). - When the tool needs a credential it runs the helper. The helper asks the daemon’s agent endpoint for the value with
cli_login. The daemon reads the host from the tool’s own request, canonicalizes it, and checks it with the same policy as every other intent: a live agent session, an unlocked vault, and a grant with disclosure for exactly this tool and host. - If any check fails, the helper prints no value. git gets no answer, Docker gets “not found”, and the AWS CLI and kubectl get a non-zero exit with the typed outcome (
scope_denied,session_required,disclosure_not_granted,grant_expired,vault_locked) on stderr.
Helpers answer only inside an agent session (ADR 0014). Start one around the harness, or around your own shell to use the helpers yourself:
bpw agent run -- claude # or: bpw agent run -- "$SHELL"
store and erase never change the vault: an agent cannot add or delete an item through a helper. Add items with bpw item add.
Grant a login
--login names a tool and, for git, Docker and kubectl, the exact host: host or host:port, lower case, no scheme. Repeat it for each tool and host. aws takes no host.
bpw grant add <item-id> --intent cli_login \
--login git=github.com --login docker=ghcr.io --login kubectl=k8s.example.com:6443 \
--allow-disclosure --expires-in-hours 8
bpw grant add <aws-key-item-id> --intent cli_login --login aws --allow-disclosure
bpw grant list # shows each "login git https://github.com"
A login grant may also allow run_with and http_request for the same credential; a rotation grant stays separate. Private and loopback IP addresses (127.0.0.1, 10.x, 192.168.x) cannot be granted: name a local cluster or registry by a DNS name instead.
An agent can check a login without getting a value:
bpw agent cli_login --tool git --site github.com
# outcome: success, the credential, and the setup lines
The MCP tool cli_login takes the same tool, site and credential.
git
bpw login git --host github.com --credential <item-id> # prints the setup
bpw login git --host github.com --credential <item-id> --apply # sets it in this repository
--apply asks “[y/N]” at a terminal and then writes two lines to the repository’s .git/config: an empty credential.https://github.com.helper (so no other helper answers for that host) and !'/path/to/bpw' git-credential --credential <item-id>, naming the full path of the bpw you ran. For one command instead:
git -c credential.helper= -c 'credential.helper=!bpw git-credential --credential <item-id>' push
Without --credential, the helper uses the one credential granted for the host, and answers needs_human if there are several. The username git sends is the item’s username, else the one in the URL, else x-access-token (which GitHub accepts with a token). A link named git-credential-bpw to bpw also works as credential.helper=bpw. The helper answers http and https hosts; in production only https has an origin, so plain http gets no answer. Set GIT_TERMINAL_PROMPT=0 for agents so git fails instead of prompting.
Docker and OCI registries
Docker runs docker-credential-<name> from PATH. Make a link to bpw with that name and name it in credHelpers:
ln -s "$(command -v bpw)" ~/.local/bin/docker-credential-bpw
{ "credHelpers": { "ghcr.io": "bpw" } }
The item needs a username (the registry account). docker login is not needed and does not work with this helper: its store is refused, so nothing an agent types into docker login reaches the vault. erase changes nothing and list is empty.
AWS CLI and SDKs
The item’s username is the access key ID and its secret the secret access key. In ~/.aws/config:
[profile bpw]
credential_process = bpw aws-creds --credential <item-id>
Then AWS_PROFILE=bpw aws sts get-caller-identity. The helper prints the long-lived key pair as credential_process JSON (Version 1). Short-lived STS credentials are planned, not built.
kubectl
In the kubeconfig, a user with an exec plugin. provideClusterInfo: true is required: the helper reads the cluster’s server from KUBERNETES_EXEC_INFO and the grant must name that host and port.
users:
- name: bpw
user:
exec:
apiVersion: client.authentication.k8s.io/v1
command: bpw
args: [kube-creds, --credential, <item-id>]
provideClusterInfo: true
interactiveMode: Never
The helper answers in the API version kubectl asked in (v1 or v1beta1) with the item’s secret as the bearer token.
gh, Wrangler and npm
These have no credential helper bpw serves. Use run_with, which injects the token for one command only:
bpw grant add <item-id> --intent run_with --argv 'gh pr view *' --allow-disclosure
The agent then calls run_with with GH_TOKEN (gh), CLOUDFLARE_API_TOKEN (Wrangler) or NPM_TOKEN (npm). Do not pipe a value into gh auth login --with-token or npm login: the tool keeps its own copy, which outlives the grant. bpw login gh, bpw login wrangler and bpw login npm print this route.
Not built yet
- OAuth device and browser logins (
gh auth login --web,wrangler login) throughcli_login: planned. request_accesscannot ask for acli_logingrant yet; you add it withbpw grant add.- A helper outside an agent session, for a person at their own terminal without
bpw agent run: planned, behind a presence check. - Short-lived AWS STS credentials: planned.
- Windows: the helpers are not tested there yet.