Hardening: session expiry and sealed handling, request timeout, list states, a11y, tested admin policy, security headers, README
CI / integration (push) Successful in 12s
CI / check (push) Successful in 15s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-10-20 11:42:01 +01:00
1 parent 265c618884
commit a63f7c0faa
30 files changed
+623 -76

No files matched your search

+4 -4
View File
@@ -47,7 +47,7 @@ test('shows managed grants and read-only other policies', async () => {
const user = setup()
expect(await screen.findByText('secret/data/app/*')).toBeInTheDocument()
const other = screen.getByText('default').closest('li')!
await user.click(within(other).getByRole('button', { name: 'View' }))
await user.click(within(other).getByRole('button', { name: 'View default' }))
expect(await within(other).findByText(/capabilities/)).toBeInTheDocument()
})
@@ -76,9 +76,9 @@ test('revoke asks for confirmation', async () => {
vi.mocked(grants.revokeAccess).mockResolvedValue()
const user = setup()
const confirm = vi.spyOn(window, 'confirm').mockReturnValueOnce(false).mockReturnValueOnce(true)
await user.click(await screen.findByRole('button', { name: 'Revoke' }))
await user.click(await screen.findByRole('button', { name: 'Revoke secret/data/app/*' }))
expect(grants.revokeAccess).not.toHaveBeenCalled()
await user.click(screen.getByRole('button', { name: 'Revoke' }))
await user.click(screen.getByRole('button', { name: 'Revoke secret/data/app/*' }))
expect(grants.revokeAccess).toHaveBeenCalledWith(client, target, ['secret/data/app/*'])
confirm.mockRestore()
})
@@ -89,7 +89,7 @@ test('a policy edited outside EnvBao is read-only', async () => {
)
setup()
expect(await screen.findByRole('alert')).toHaveTextContent('changed outside EnvBao')
expect(screen.getByRole('button', { name: 'Revoke' })).toBeDisabled()
expect(screen.getByRole('button', { name: 'Revoke x' })).toBeDisabled()
expect(screen.queryByRole('form', { name: 'Grant access' })).not.toBeInTheDocument()
})
+3 -2
View File
@@ -17,7 +17,7 @@ function PolicyView({ client, name }: { client: BaoClient; name: string }) {
return (
<li>
{name}{' '}
<button type="button" aria-expanded={open} onClick={() => setOpen(!open)}>
<button type="button" aria-label={`${open ? 'Hide' : 'View'} ${name}`} aria-expanded={open} onClick={() => setOpen(!open)}>
{open ? 'Hide' : 'View'}
</button>
{open && <pre>{hcl.isPending ? 'Loading…' : (hcl.data ?? 'Could not read this policy.')}</pre>}
@@ -82,7 +82,7 @@ export function AccessEditor({ client, target, onClose }: Props) {
</p>
)}
{s.managed?.grants.length ? (
<table>
<table aria-label="Granted by EnvBao">
<thead>
<tr>
<th>Path</th>
@@ -100,6 +100,7 @@ export function AccessEditor({ client, target, onClose }: Props) {
<td>
<button
type="button"
aria-label={`Revoke ${g.path}`}
disabled={!editable}
onClick={() => window.confirm(`Revoke ${g.capabilities.join(', ')} on ${g.path}?`) && revoke.mutate(g.path)}
>