ADR 047: Credential input paths and enforceable keyring storage¶
This page is generated from docs/decisions/*.yaml by task docs:export-adr-markdown. Do not edit manually.
- Number:
047 - Title:
Credential input paths and enforceable keyring storage - Category:
architecture - Status:
accepted - Amended By:
083 - Provenance:
guided-ai - Source:
docs/decisions/047-credential-input-and-keyring-enforcement.yaml
Decision¶
Never require a secret to be passed as a command-line flag value. bb auth login accepts --token-stdin and --password-stdin, which read one credential from stdin, and these are the forms the README, the quickstart and the agent skill teach. The --token and --password flags remain for compatibility and warn on stderr when used. Make keyring-backed storage enforceable rather than merely preferred. --require-keyring and BB_REQUIRE_KEYRING=1 turn a keyring failure into an error instead of a silent degradation to the plaintext config fallback, and the refusal happens before any secret is written. Enforce the policy where credentials are read as well as where they are written, so a config file written before the policy was set cannot keep serving plaintext credentials. Report how the credential in use is held. bb auth status prints a credentialStorage value of keyring, environment, config-file-plaintext or none, and a plaintext credential warns once per process on stderr rather than only at login. Scope keyring entries to the configuration file. An entry is keyed by the host and a digest of the file's canonical path -- absolute, its directory's symlinks resolved, case-folded on Windows -- so two configuration files keep two identities for one host. An entry keyed by host alone, as written before, answers only for a file that has no entry of its own, and logout removes it only for the file that was using it.
Agent Instructions¶
The --token and --password flags this record kept for compatibility were removed in v4: ADR-083 says no flag carries a secret at all. The instruction below did not change; what changed is that nothing is exempt from it. Do not add a flag whose value is a secret. If a command needs one, read it from stdin and add a matching --
Rationale¶
A flag value is visible to every local user through ps and /proc/
Rejected Alternatives¶
Remove --token and --password outright: Breaks every existing script and CI job for a risk that is sometimes acceptable — a single-user workstation, an interactive shell with history disabled. A warning on stderr moves the default without breaking callers who have considered the trade-off.Prompt interactively for the secret when no flag is given: Good for humans, useless for the primary consumer. An agent or CI job has no terminal, and a prompt that blocks on a closed stdin turns a clear error into a hang. Worth adding alongside the stdin path later; it does not replace it.Make --require-keyring the default now: It is the right end state, but it turns a working login into a failure on every headless host the moment the version is upgraded. That is a breaking change and belongs in a major release with the fallback behind an explicit --allow-insecure-storage.Encrypt the config-file fallback instead of refusing it: The key would have to live beside the ciphertext or be derived from something the machine already exposes, so it obscures the secret rather than protecting it, while presenting itself as protection. Refusing, or naming the exposure plainly, is more honest than either.Enforce the policy only when reading, not at login: Would let a login appear to succeed while writing a credential the next command refuses to use, and would leave the secret on disk in the meantime. Refusing at the point of writing is both clearer and safer.