Skip to content

HashiCorp Vault dynamic database credentials #2500

Closed

Description

@datlechin

Problem

The Vault password source reads one field of a static KV secret: it runs vault kv get -field=<field> <path> (apple/TablePro/Core/Utilities/Connection/PasswordSourceResolver.swift:99-100) and needs VAULT_ADDR and VAULT_TOKEN in TablePro's environment (features/connection-sharing.mdx:174). It is set in a credential profile under Read from elsewhere or in connections.json.

Vault's database secrets engine issues a fresh username and password per lease, which is how many teams hand out database access, and TablePro cannot use it:

  • A password source returns a password only. The username always comes from the connection or the credential profile (apple/TablePro/Core/Database/ConnectionCredentialResolver.swift:53-58), while a dynamic role generates the username too.
  • Nothing renews the lease, so the server drops the generated user while the connection is still open.

Proposed solution

  • A Vault Database Role source in the credential profile editor, taking a mount and a role. It reads <mount>/creds/<role> and signs in with both the username and the password it returns.
  • Fetch a new lease on every sign-in, the way AWS IAM and Cloud SQL IAM tokens are minted per sign-in today (ConnectionCredentialResolver.swift:27-29), so a reconnect never reuses an expired user.
  • Renew the lease before it expires while the connection is open, and reconnect with a new lease when renewal fails or the lease reaches its maximum TTL.
  • Sign in to Vault with the token from VAULT_TOKEN or ~/.vault-token, or with AppRole or OIDC, and say which one failed when it does.
  • Never write a leased credential to the Keychain or to connections.json. It is short-lived by design.

Done when: a connection on a dynamic role connects with the generated user, stays connected past the default lease TTL, and reconnects with a new user after the lease is revoked.

Alternatives considered

Read a lease with the vault CLI, paste the username and password into the connection, and do it again when the lease expires.

Platform

macOS

Related database type

N/A / General

Activity

  1. added
    enhancement
    on Aug 26, 2026
  2. added
    platform-macos
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplatform-macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions