Rework Secrets page into browser and detail panes
- Two panes: folder browser on the left, access detail card on the right, so selecting a secret no longer shifts the page. Stacks on narrow screens. - Mount is the first crumb; the mount dropdown only shows with several engines. - Drop emoji for chevrons; capability chips, red for delete/sudo; identity type tags; root token collapsed to "full access". Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fbe9cc9262
commit
68e564eb6c
4 files changed
+180
-61
No files matched your search
@@ -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 <p>Loading access…</p>
|
||||
if (data.error) return <p role="alert">Could not load access: {data.error.message}</p>
|
||||
|
||||
const path = dataPath(mount, secret)
|
||||
const entries = accessForPath(data.data.identities, data.data.policies, path, pathMatches)
|
||||
|
||||
return (
|
||||
<section aria-label="Access">
|
||||
<h2>Access to {secret}</h2>
|
||||
<p>
|
||||
Evaluated against <code>{path}</code>
|
||||
</p>
|
||||
{data.data.notes.map((n) => (
|
||||
<section aria-label="Access" className="secret-detail">
|
||||
<header>
|
||||
<h2>{secret}</h2>
|
||||
<code>{path}</code>
|
||||
</header>
|
||||
{data.isPending && <p className="hint">Loading access…</p>}
|
||||
{data.error && <p role="alert">Could not load access: {data.error.message}</p>}
|
||||
{data.data && <Entries data={data.data} path={path} />}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
function Entries({ data, path }: { data: NonNullable<ReturnType<typeof useAccessInputs>['data']>; path: string }) {
|
||||
const entries = accessForPath(data.identities, data.policies, path, pathMatches)
|
||||
return (
|
||||
<>
|
||||
{data.notes.map((n) => (
|
||||
<p key={n} role="alert">
|
||||
Incomplete: could not read {n}
|
||||
</p>
|
||||
@@ -33,22 +42,38 @@ export function AccessPanel({ client, mount, secret }: Props) {
|
||||
{entries.length === 0 ? (
|
||||
<p>No identity can reach this secret.</p>
|
||||
) : (
|
||||
<table>
|
||||
<table aria-label="Who can access this secret">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Identity</th>
|
||||
<th>Type</th>
|
||||
<th>Via policy</th>
|
||||
<th>Capabilities</th>
|
||||
<th>Can</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{entries.map((e) => (
|
||||
<tr key={`${e.identity.kind}:${e.identity.name}:${e.policy}`}>
|
||||
<td>{e.identity.name}</td>
|
||||
<td>{e.identity.kind}</td>
|
||||
<td>{e.policy}</td>
|
||||
<td>{e.capabilities.join(', ')}</td>
|
||||
<td>
|
||||
<span>{e.identity.name}</span> <span className="tag">{e.identity.kind}</span>
|
||||
</td>
|
||||
<td>
|
||||
<code>{e.policy}</code>
|
||||
</td>
|
||||
<td>
|
||||
{e.policy === 'root' ? (
|
||||
<ul className="chips">
|
||||
<li className="risky">full access</li>
|
||||
</ul>
|
||||
) : (
|
||||
<ul className="chips">
|
||||
{e.capabilities.map((c) => (
|
||||
<li key={c} className={RISKY.has(c) ? 'risky' : undefined}>
|
||||
{c}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
@@ -57,6 +82,6 @@ export function AccessPanel({ client, mount, secret }: Props) {
|
||||
<p className="hint">
|
||||
Only the most specific matching policy path applies, as in OpenBao. Parameter constraints and templated paths are approximated.
|
||||
</p>
|
||||
</section>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user