Introducing a new way to review your PRs.

Read the announcement

hcavarsan / pipedash

One dashboard for CI/CD pipelines across multiple providers

View on GitHub

19 documents · Updated Nov 23, 2026

docs / credential-and-vault

Credential and vault management

Credential and vault management protects the secrets that let Pipedash connect to providers and storage. The system keeps provider tokens separate from normal provider configuration, selects a secure store for the runtime, and blocks provider use until the store is ready. The desktop uses the system keyring by default. Other storage modes use an encrypted database that opens through the vault UI.

Credential model

Provider credentials

Provider credentials are the secret part of a provider connection. The core system gives them a small storage contract so provider services can save, read, list, and remove tokens without knowing where the secrets live. A sign-in credential can also carry refresh data and expiry details, so the same protected value can support token renewal without exposing it in normal logs or summaries.

The credential path has two boundaries:

  • Provider configuration describes how to connect.
  • The credential store holds the token or sign-in value needed to connect.

This separation lets the application change storage backends without changing provider behavior. It also keeps credentials out of ordinary configuration views.

Provider configuration can carry a token reference instead of a secret value. During synchronization, core keeps that reference with the provider record and places the resolved value in the protected token store. An unresolved reference does not overwrite an existing token during an update, while a new provider receives an empty token until the user supplies one.

References: crates/…/token_store.rs• L11-41 crates/…/credential.rs• L19-66 crates/…/sync.rs• L193-221 crates/…/sync.rs• L247-277

Configuration persistence

Configuration persistence connects the file view of a provider to the runtime provider and credential stores. Core loads and validates the configuration, applies environment overrides when it reads settings, and reloads the in-memory state only after a valid file update.

Provider synchronization compares the current file block with the database record before it changes provider data. It can add or update providers, remove file orphans when the selected mode allows it, and export provider settings without exporting secret values. Exported providers use preserved environment references or generated placeholders so the export can be shared without becoming a secret backup.

The selected storage backend and its location are persistent configuration. A vault password remains runtime state and is not written into the serialized configuration. When core updates a configuration file, it keeps existing comments and valid environment references when the resolved value has not changed. Configuration writes use an atomic file replacement path that resolves symlinks, preserves the existing file mode, and falls back to a direct write only for file-system errors where replacement is not available. This keeps a failed or interrupted save from leaving a partial configuration file in the normal case.

This diagram shows how configuration input reaches provider records and protected token storage.

flowchart LR
    A[Configuration file] --> B[Load and validate]
    B --> C[Provider synchronization]
    C --> D[Provider records]
    C --> E[Resolved token]
    E --> F[Protected token store]
    D --> G[Provider runtime]
    F --> G
    G --> H[Provider access]

References: crates/…/state.rs• L54-100 crates/…/state.rs• L144-169 crates/…/state.rs• L227-260 crates/…/sync.rs• L45-119 crates/…/sync.rs• L288-325 crates/…/persistence.rs• L24-141 crates/…/persistence.rs• L22-112 crates/…/file.rs• L15-64 crates/…/tests.rs• L5-73 crates/…/schema.rs• L231-267

Storage paths

Desktop keyring

The desktop stores provider tokens in the operating system keyring. This path does not need a vault password for local SQLite use because the device protects the keyring entry. The store reads and writes a grouped set of provider tokens and keeps a short-lived in-process copy so provider work can continue without repeated keyring access.

The desktop also understands older per-provider keyring entries. A read can move an old entry into the current grouped form. This preserves existing credentials while the storage model changes.

References: crates/…/keyring_store.rs• L27-121 crates/…/keyring_store.rs• L124-229 crates/…/lib.rs• L126-161

Encrypted database stores

When the keyring path is not used, the vault password protects provider tokens in the selected database. SQLite stores encrypted tokens with the local database. PostgreSQL stores them in its encrypted-token store. Both paths use a protected vault marker to check the password before they load tokens for the session.

Each new database vault gets its own random key-derivation salt. Older vaults can open with their legacy derivation settings and then move to the current salted form without losing tokens. The upgrade is guarded so a wrong password or a competing process cannot claim the vault or overwrite a completed upgrade.

These stores are the fallback for server use and for desktop migrations away from the keyring. They also support encrypted export and import. Backup data uses a separate password and never becomes plain text during the transfer.

The configuration selects either SQLite or PostgreSQL and records the data location or PostgreSQL connection setting needed by that store. The vault password is not persisted in the configuration file, which keeps database access credentials outside normal configuration output.

References: crates/…/crypto.rs• L23-109 crates/…/vault.rs• L84-127 crates/…/sqlite.rs• L30-49 crates/…/postgres.rs• L34-61 crates/…/tests.rs• L188-228 crates/…/tests.rs• L186-223 crates/…/schema.rs• L231-267 crates/…/persistence.rs• L107-141 crates/…/file.rs• L15-64

Native secure stores

Mobile builds use native secure storage for device credentials. iOS selects protected keychain entries with device-only access rules. Android selects the Android secure store. Background work uses a separate access mode where the platform supports it, so the app can use the needed credential after the first device unlock.

The setup UI presents this as on-device storage. Mobile users therefore do not set a database vault password for provider tokens. The native store remains the device boundary for those credentials.

References: crates/…/credential.rs• L1-53 src/…/StorageStep.tsx• L58-89

Vault lifecycle

Vault state

The vault is the runtime gate for protected credentials. Its status reports whether the store is open, which backend is active, whether a password is needed, and where the password came from. A session password can come from the PIPEDASH_VAULT_PASSWORD environment variable or from a successful unlock. Desktop keyring use reports no password requirement instead.

If the password is missing, core can start in a locked mode with no usable provider tokens. Unlocking creates the real token store, marks it ready, and reloads provider work. Locking removes the session password and makes the application require authentication again.

References: crates/…/vault.rs• L24-138 crates/…/manager.rs• L85-185 crates/…/commands.rs• L1417-1525

Unlock flow

The unlock flow connects the vault status, the user interface, and core storage. A protected route checks both the application session and the vault state before it renders its content. If the vault needs access, the user goes to the unlock page. A successful unlock refreshes vault data, reconnects the live session, and returns only to a valid in-app path.

The main sequence is:

  1. The client requests vault status.
  2. The application routes to the unlock page when the session or vault is not ready.
  3. The user enters the password or uses an allowed native unlock method.
  4. The service opens the encrypted store and warms provider state.
  5. The client refreshes its status, reconnects the live session, and returns to the requested page when that page is an app path.

This diagram shows the relationship between the UI gate, the service boundary, and credential persistence.

flowchart LR
    A[Protected page] --> B[Session and vault status]
    B -->|Needs access| C[Unlock UI]
    C -->|Password or native unlock| D[Vault service]
    D --> E{Credential store}
    E -->|Desktop| F[System keyring]
    E -->|Other storage| G[Encrypted database]
    F --> H[Ready core session]
    G --> H
    H --> I[Provider access]

References: src/…/RequireAuth.tsx• L20-77 src/…/UnlockRoute.tsx• L15-53 src/…/useVaultQueries.ts• L40-73 src/…/UnlockRoute.test.tsx• L85-93

Native app lock

Mobile app lock adds a second gate around an already protected session. The user can enable it after authenticating. The setting can lock the app when it moves to the background. A biometric prompt then restores the session without asking the user to type the vault password when the device has a saved vault password.

When the mobile app moves to the background, a privacy cover hides its content. When it becomes visible, the app refreshes vault status before it removes the cover. App lock therefore controls both access to the saved credential and the visibility of protected content.

App lock does not replace credential storage. It controls when the native app may use the saved credential and when the core session is considered ready. Disabling app lock also removes its saved vault password.

References: crates/…/app_lock.rs• L37-52 crates/…/app_lock.rs• L447-572 src/…/appLock.ts• L19-31 src/…/PrivacyCover.tsx• L19-47

Vault interface

Unlock controls

The vault UI adapts to the reported state instead of assuming that every platform needs a password. It waits for vault status and offers a retry when that status cannot load. First-time setup asks for password confirmation. A later unlock asks only for the password. Mobile can show biometric or plain device unlock controls, while desktop shows the password path when the selected backend needs it.

The form validates required and matching passwords before it calls the service. It disables duplicate submissions, clears secret fields after success, and keeps a failed password message visible until the user edits the input. Biometric unlock may prompt once automatically. A cancelled prompt leaves the user on the unlock screen without showing a password error.

References: src/…/UnlockForm.tsx• L18-110 src/…/UnlockPasswordForm.tsx• L34-169 src/…/UnlockAlternativeControls.tsx• L23-114 src/…/UnlockForm.test.tsx• L141-176 src/…/UnlockForm.test.tsx• L254-287 src/…/UnlockForm.test.tsx• L383-425

Storage settings

Storage settings explain which boundary protects credentials. They show the system keyring for desktop local storage, encrypted database storage for SQLite or PostgreSQL, and the native secure store on mobile. The setup flow also warns when a desktop migration moves credentials from the keyring into a password-protected database.

The settings page can lock an active vault and start storage configuration or migration. It does not display the stored credential values.

References: src/…/StorageSection.tsx• L104-160 src/…/StorageSection.tsx• L193-281 src/…/StorageStep.tsx• L103-204

  • Secure connectivity describes how protected connections fit into the wider connection system.
  • Authentication and pairing describes user authentication and device pairing flows that can lead to a ready session.
  • Core domain and persistence describes the shared domain records and persistence boundaries that hold provider state.
  • Application hosts describes how desktop, server, and mobile hosts provide the runtime context for credential storage.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the desktop status contract aligned with the web vault status contract so the UI does not confuse keyring access with a password-protected store.
  • Keep each TokenStore backend aligned with the storage manager's locked-mode and unlock transitions.
  • Keep per-vault salt and legacy-vault upgrade rules aligned across SQLite and PostgreSQL so both stores preserve old tokens without accepting an unverified password.
  • Keep native app-lock changes aligned with the keyring account used to save and remove the vault password.
  • Keep migration changes aligned with the keyring-to-encrypted-database warning and the encrypted export/import contract.
  • Keep unlock success handling aligned with provider reloads, query invalidation, live-session reconnects, and safe in-app return paths.
  • Keep the privacy cover aligned with mobile visibility changes so protected content is not shown before vault status refresh completes.
  • Keep provider file references, provider records, and protected token values aligned when the configuration schema or synchronization rules change.
  • Keep storage backend changes aligned across configuration validation, database selection, vault status, and storage settings.
  • Keep configuration saves from resolving environment-backed secrets into the file when an update changes unrelated settings.
  • Keep atomic configuration writes aligned with symlink targets, file permissions, and the fallback path so a storage update does not replace the wrong file or leave a partial file.

Important failure modes

TriggerConsequenceGuard
Wrong vault passwordThe encrypted store refuses to open and provider tokens remain unavailable.The vault verifier and token decryption reject the session before provider work starts.
Missing keyring permission or unavailable native storeDesktop credentials cannot be saved or mobile credentials cannot be read.The credential layer returns a storage error and the UI keeps the vault unavailable.
Vault password missing at startupCore starts in locked mode with an empty token store.Vault status sends the user to unlock before protected pages load.
Biometric authentication is cancelledThe app stays locked without treating cancellation as a bad password.Native unlock returns a cancelled result and the UI keeps the unlock controls visible.
Legacy vault upgrade cannot be verified or savedThe old vault remains usable, or opening fails when no safe vault state exists.The vault checks the verifier, uses a random per-vault salt, and only claims a successful upgrade.
Keyring credentials are migrated to a database without a vault passwordThe user can lose access to provider connections after the storage change.Setup warns that the new database needs a vault password and validates its confirmation.
Unlock return target is external or malformedThe user could be sent outside the application after unlocking.The route accepts only an absolute app path and otherwise returns to the root.
A token reference cannot resolve during provider synchronizationA new provider has no usable token, or an existing provider keeps its prior protected token.Synchronization stores an empty value only for new providers and does not overwrite existing tokens on a failed reference.
A configuration file names PostgreSQL without a connection settingCore cannot use the selected storage backend.Storage validation rejects the configuration before the backend starts.
A configuration write targets a read-only file or cannot replace its pathThe new settings are not saved, while the prior file remains intact in the guarded path.The writer checks read-only files, writes a synced temporary file, and only uses direct replacement for specific file-system errors.

Key files

FileWhy to read it
crates/…/token_store.rsDefines the common credential storage contract and non-persistent store behavior.
crates/…/keyring_store.rsShows the desktop keyring path and legacy credential migration.
crates/…/credential.rsShows the platform bridge for desktop and native secure stores.
crates/…/schema.rsDefines storage backend choices, provider file records, and the rule that the vault password is not serialized.
crates/…/state.rsShows configuration loading, validation, reload, environment overrides, and the link to the token store.
crates/…/persistence.rsShows how storage and provider-related configuration updates preserve the file boundary.
crates/…/persistence.rsShows how configuration state updates preserve existing TOML and publish the new in-memory state.
crates/…/file.rsShows the safe file-write boundary used for configuration persistence.
crates/…/tests.rsShows the guarantees for replacement, read-only files, symlinks, and file modes.
crates/…/sync.rsShows how provider file records, database records, token references, and protected token values stay in sync.
crates/…/manager.rsShows how the runtime selects a store and enters or leaves locked mode.
crates/…/vault.rsShows vault verification, token loading, per-vault key upgrades, and encrypted backup behavior.
crates/…/crypto.rsShows the key derivation and authenticated encryption boundary for vault data and backups.
crates/…/sqlite.rsShows local encrypted database persistence and vault verification.
crates/…/postgres.rsShows shared encrypted database persistence for PostgreSQL.
crates/…/vault.rsDefines the web vault status, unlock, and lock boundary.
crates/…/app_lock.rsDefines native biometric unlock and app-lock handling.
src/…/RequireAuth.tsxShows how protected pages wait for both session and vault readiness.
src/…/PrivacyCover.tsxShows how mobile backgrounding hides protected content until status refresh.
src/…/UnlockForm.tsxShows the platform-aware vault controls presented to users.
src/…/UnlockRoute.tsxShows unlock completion, live-session reconnect, and safe return navigation.
src/…/StorageSection.tsxShows how users view storage protection and lock the vault.