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

+17
View File
@@ -47,11 +47,28 @@ describe('BaoClient', () => {
[403, 'forbidden'],
[404, 'not-found'],
[500, 'server'],
[503, 'unavailable'],
])('maps HTTP %i to %s', async (status, kind) => {
mockFetch(status, { errors: ['nope'] })
await expect(new BaoClient('http://b').request('GET', 'x')).rejects.toMatchObject({ kind, status })
})
test('503 explains that OpenBao is sealed or unavailable', async () => {
mockFetch(503, { errors: ['Vault is sealed'] })
await expect(new BaoClient('http://b').request('GET', 'x')).rejects.toThrow('sealed or unavailable')
})
test('a timeout is reported as such, not as a CORS problem', async () => {
vi.stubGlobal('fetch', vi.fn().mockRejectedValue(new DOMException('slow', 'TimeoutError')))
await expect(new BaoClient('http://b').request('GET', 'x')).rejects.toThrow('did not respond within')
})
test('passes a timeout signal to fetch', async () => {
const fn = mockFetch(200, {})
await new BaoClient('http://b').request('GET', 'x')
expect((fn.mock.calls[0] as unknown as [string, RequestInit])[1].signal).toBeInstanceOf(AbortSignal)
})
test('non-JSON success is a bad-response', async () => {
mockFetch(200, '<html>')
await expect(new BaoClient('http://b').request('GET', 'x')).rejects.toMatchObject({ kind: 'bad-response' })