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:
mattandClaude Sonnet 5.5 committed 2026-11-09 13:30:08 +00:00
1 parent 4fa7ff1497
commit 48746e2150
15 files changed
+1089 -18

No files matched your search

+18
View File
@@ -14,6 +14,7 @@ import {
} from '../../api/engines/roles'
import { ListState } from '../shared/ListState'
import { useConfirm } from '../shared/useConfirm'
import { GenerateCreds } from './GenerateCreds'
import { RoleEditor } from './RoleEditor'
export function RolesPanel({ client, mount, engine }: { client: BaoClient; mount: string; engine: EngineDef }) {
@@ -23,6 +24,7 @@ export function RolesPanel({ client, mount, engine }: { client: BaoClient; mount
const kind = engine.roleKinds.find((k) => k.id === kindId) ?? engine.roleKinds[0]
const [draft, setDraft] = useState<RoleDraft | null>(null)
const [formError, setFormError] = useState<string | null>(null)
const [credsFor, setCredsFor] = useState<string | null>(null)
const key = ['engine-roles', mount, kind.id]
const roles = useQuery({ queryKey: key, queryFn: () => listRoles(client, mount, kind) })
@@ -49,6 +51,7 @@ export function RolesPanel({ client, mount, engine }: { client: BaoClient; mount
const switchKind = (id: string) => {
setKindId(id)
setDraft(null)
setCredsFor(null)
save.reset()
}
@@ -77,6 +80,11 @@ export function RolesPanel({ client, mount, engine }: { client: BaoClient; mount
<tr key={name}>
<td>{name}</td>
<td>
{kind.creds.length > 0 && (
<button type="button" aria-label={`Generate ${name}`} onClick={() => setCredsFor(name)}>
Generate
</button>
)}
<button type="button" aria-label={`Edit ${name}`} onClick={() => edit.mutate(name)}>
Edit
</button>
@@ -102,6 +110,16 @@ export function RolesPanel({ client, mount, engine }: { client: BaoClient; mount
</tbody>
</table>
)}
{credsFor && (
<GenerateCreds
key={`${kind.id}/${credsFor}`}
client={client}
mount={mount}
role={credsFor}
kinds={kind.creds}
onClose={() => setCredsFor(null)}
/>
)}
{remove.error && <p role="alert">{remove.error.message}</p>}
{edit.error && <p role="alert">{edit.error.message}</p>}
{!draft && (