Secrets: engine config editors and one-time credential generation
Adds Config tab (database connections with rotate/reset, aws root and lease, ssh CA with generate/import) and a Generate action on roles (database/static creds, aws creds, ssh sign and OTP). Secret inputs are write-only: never prefilled and omitted when blank so the stored value is kept. Issued credentials live only in a gcTime-0 mutation and are shown once, with revoke-now for leased credentials. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4fa7ff1497
commit
48746e2150
15 files changed
+1089
-18
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import type { BaoClient } from '../bao'
|
||||
import type { CredKind } from './registry'
|
||||
import type { RoleData } from './roles'
|
||||
|
||||
/** Credentials as issued. These are secrets: show them once and never put them in a query cache. */
|
||||
export interface Credentials {
|
||||
/** Empty for credentials without a lease (database static roles). */
|
||||
leaseId: string
|
||||
/** Seconds; 0 when the credentials have no expiry. */
|
||||
leaseDuration: number
|
||||
renewable: boolean
|
||||
data: Record<string, unknown>
|
||||
warnings: string[]
|
||||
}
|
||||
|
||||
interface CredResponse {
|
||||
lease_id?: string
|
||||
lease_duration?: number
|
||||
renewable?: boolean
|
||||
data?: Record<string, unknown>
|
||||
warnings?: string[] | null
|
||||
}
|
||||
|
||||
export async function generateCreds(c: BaoClient, mount: string, kind: CredKind, role: string, body: RoleData): Promise<Credentials> {
|
||||
const path = `${mount}${kind.path(role)}`
|
||||
const res = await c.request<CredResponse>(kind.method, path, kind.method === 'POST' ? body : undefined)
|
||||
return {
|
||||
leaseId: res.lease_id ?? '',
|
||||
leaseDuration: res.lease_duration ?? 0,
|
||||
renewable: res.renewable ?? false,
|
||||
data: res.data ?? {},
|
||||
warnings: res.warnings ?? [],
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user