Checkpoint recovered orchestration core with tested fail-closed boundaries
This commit is contained in:
1 parent
c7f1d25e98
commit
0952a482fb
18 files changed
+1918
-129
No files matched your search
@@ -30,6 +30,12 @@ describe('installed Hermes health contract', () => {
|
||||
);
|
||||
expect(fetcher.mock.calls[0][1].redirect).toBe('error');
|
||||
});
|
||||
it('refuses a runtime reporting that authentication is disabled', async () => {
|
||||
const adapter = new HermesAdapter({origin:'http://canina-hermes:9119',token:async()=> 'private'},
|
||||
jest.fn().mockResolvedValue(new Response(JSON.stringify({...health,auth_required:false}))));
|
||||
await expect(adapter.health()).rejects.toMatchObject({code:'AUTH_REQUIRED'});
|
||||
});
|
||||
|
||||
it('fails closed for bad origin, auth errors, malformed contract and oversized bodies', async () => {
|
||||
expect(
|
||||
() =>
|
||||
|
||||
@@ -132,12 +132,14 @@ export class HermesAdapter {
|
||||
}
|
||||
}
|
||||
async health(): Promise<Health> {
|
||||
return fields(await this.request('/api/health'), {
|
||||
const health = fields(await this.request('/api/health'), {
|
||||
ok: 'boolean',
|
||||
version: 'string',
|
||||
commit: 'string',
|
||||
auth_required: 'boolean',
|
||||
}) as unknown as Health;
|
||||
if (!health.auth_required) throw new HermesError('AUTH_REQUIRED');
|
||||
return health;
|
||||
}
|
||||
async status(profile: string): Promise<Row> {
|
||||
const raw = object(await this.request('/api/status', profile));
|
||||
|
||||
Reference in new issue
Block a user