Repository navigation
Description
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_TOKENor~/.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