Skip to main content

Crate ai6_secret_bitwarden

Crate ai6_secret_bitwarden 

Source
Expand description

ai6-secret-bitwarden: the bitwarden secret provider. A secret is a field of one item of a Bitwarden or Vaultwarden vault, read through the bw command line, which decrypts on this host: the server only ever holds the encrypted vault. Credentials reach bw in its environment, never in an argument. Calls block; the host calls them off its async runtime.

§ai6-secret-bitwarden

Version Rust version License: MPL-2.0 Docs CI

The bitwarden secret provider for AI6: a secret is a field of one item of a Bitwarden or Vaultwarden vault, read through the bw command line, which decrypts on this host: the server only ever holds the encrypted vault. See the API header.

§Features

  • One item’s password, username, notes, uri, totp seed or custom field per secret.
  • Logs the CLI in with an API key and unlocks it with the master password, or takes an unlocked vault’s session key; keeps the session and replaces it once if it lapses.
  • Credentials are secret references the Station reads when it builds the instance, and travel to bw in its environment, never in an argument; a BW_* variable of the Station’s own is not passed on.
  • https servers only unless the operator sets allow_http.
  • No value in any error or Debug; every buffer that held one is wiped.

§Installation

Part of the AI6 workspace; built with it, and loaded by a Station through [station.plugins]. It needs the Bitwarden CLI (bw) on the Station’s host:

cargo build -p ai6 --features cli -p ai6-secret-bitwarden

§Quick start

[secret_provider.vault]
provider = "bitwarden"
server = "https://vault.example"
data_dir = "/var/lib/ai6/bw"                      # a CLI state of its own
client_id = "user.00000000-0000-0000-0000-000000000000"
client_secret = { provider = "file", key = "bw-client-secret" }
password = { provider = "file", key = "bw-master" }

[secret.forge]
provider = "vault"
key = "forge token"                               # the item's name, or its ID
field = "password"                                # the default
env = "GH_TOKEN"

§Development

cargo test -p ai6-secret-bitwarden
cargo clippy -p ai6-secret-bitwarden --all-targets -- -D warnings

The tests run on a stand-in bw that keeps a small vault; no account is needed. The ignored live test (tests/live.rs) needs a Vaultwarden account made for it and the AI6_TEST_BW_* settings the file lists, plus AI6_TEST_LIVE_SECRETS=1.

§License

MPL-2.0. See LICENSE.

Structs§

Bitwarden
Reads fields of a Bitwarden vault’s items through the bw command line.
BitwardenConfig
One instance’s settings, from [secret_provider.<name>].
BitwardenFields
What one secret names besides key (the item’s name or ID).
Call
One call of bw: its arguments (never a secret) and the variables it runs with.
Outcome
What bw left.
RunError
Why bw could not be run to its end. The text holds no value.

Constants§

PROVIDER_ID
The provider ID a [secret_provider.<name>] instance or a secret names.

Statics§

guatiao_declares
What this library declares, read by a scanner as data.

Traits§

Runner
Runs the bw program: what the provider needs of the Bitwarden CLI.

Functions§

guatiao_library_entry⚠
The symbol a guatiao host loads this library by.