diff --git a/src/features/secrets/AccessPanel.tsx b/src/features/secrets/AccessPanel.tsx
index d2dab8f..b0fe5fb 100644
--- a/src/features/secrets/AccessPanel.tsx
+++ b/src/features/secrets/AccessPanel.tsx
@@ -10,22 +10,31 @@ interface Props {
secret: string
}
+// Capabilities that let someone change or remove the secret, or bypass policy checks.
+const RISKY = new Set(['delete', 'sudo'])
+
export function AccessPanel({ client, mount, secret }: Props) {
const data = useAccessInputs(client)
-
- if (data.isPending) return
Loading access…
- if (data.error) return Could not load access: {data.error.message}
-
const path = dataPath(mount, secret)
- const entries = accessForPath(data.data.identities, data.data.policies, path, pathMatches)
return (
-
- Access to {secret}
-
- Evaluated against {path}
-
- {data.data.notes.map((n) => (
+
+
+ {data.isPending && Loading access…
}
+ {data.error && Could not load access: {data.error.message}
}
+ {data.data && }
+
+ )
+}
+
+function Entries({ data, path }: { data: NonNullable['data']>; path: string }) {
+ const entries = accessForPath(data.identities, data.policies, path, pathMatches)
+ return (
+ <>
+ {data.notes.map((n) => (
Incomplete: could not read {n}
@@ -33,22 +42,38 @@ export function AccessPanel({ client, mount, secret }: Props) {
{entries.length === 0 ? (
No identity can reach this secret.
) : (
-
+
| Identity |
- Type |
Via policy |
- Capabilities |
+ Can |
{entries.map((e) => (
- | {e.identity.name} |
- {e.identity.kind} |
- {e.policy} |
- {e.capabilities.join(', ')} |
+
+ {e.identity.name} {e.identity.kind}
+ |
+
+ {e.policy}
+ |
+
+ {e.policy === 'root' ? (
+
+ ) : (
+
+ {e.capabilities.map((c) => (
+ -
+ {c}
+
+ ))}
+
+ )}
+ |
))}
@@ -57,6 +82,6 @@ export function AccessPanel({ client, mount, secret }: Props) {
Only the most specific matching policy path applies, as in OpenBao. Parameter constraints and templated paths are approximated.
-
+ >
)
}
diff --git a/src/features/secrets/SecretsPage.test.tsx b/src/features/secrets/SecretsPage.test.tsx
index 1008e5d..b6a86a4 100644
--- a/src/features/secrets/SecretsPage.test.tsx
+++ b/src/features/secrets/SecretsPage.test.tsx
@@ -66,7 +66,8 @@ test('navigates folders and shows who can reach a secret', async () => {
const panel = await screen.findByRole('region', { name: 'Access' })
const row = (await within(panel).findByText('alice')).closest('tr')!
expect(within(row).getByText('app-rw')).toBeInTheDocument()
- expect(within(row).getByText('read, update')).toBeInTheDocument()
+ expect(within(row).getByText('read')).toBeInTheDocument()
+ expect(within(row).getByText('update')).toBeInTheDocument()
expect(within(panel).queryByText('bob')).not.toBeInTheDocument()
expect(within(panel).getByText('secret/data/app/db')).toBeInTheDocument()
})
diff --git a/src/features/secrets/SecretsPage.tsx b/src/features/secrets/SecretsPage.tsx
index cef05c0..aa2cda2 100644
--- a/src/features/secrets/SecretsPage.tsx
+++ b/src/features/secrets/SecretsPage.tsx
@@ -28,50 +28,62 @@ function Browser({ client }: { client: BaoClient }) {
if (mounts.isPending) return Loading…
if (!mount) return No KV v2 secrets engines are mounted.
+ const where = prefix ? `${mount}${prefix}` : mount
+
return (
- <>
-
-
- {entries.error && {entries.error.message}
}
- {entries.data?.length === 0 && Nothing here.
}
-
- {entries.data?.map((e) => (
- -
-