Protect Studio catalog images and expose canonical workspace bootstrap
This commit is contained in:
@@ -129,3 +129,18 @@ test('unknown API paths return JSON rather than an HTML success document', async
|
||||
assert.match(result.headers.get('content-type'), /application\/json/);
|
||||
assert.match(result.headers.get('cache-control'), /no-store/);
|
||||
});
|
||||
|
||||
test('workspace bootstrap returns canonical client identity without reading saved catalogs', async t => {
|
||||
const f = await setup(t);
|
||||
const a = await f.call('a', '/api/workspace?clientId=victim&tenant=tenant-b');
|
||||
assert.equal(a.status, 200);
|
||||
assert.equal(a.body.workspace.tenant, 'tenant-a');
|
||||
assert.match(a.body.workspace.clientId, /^[a-f0-9-]{36}$/);
|
||||
assert.equal(a.body.workspace.canWriteProducts, true);
|
||||
assert.equal(a.body.stores, undefined);
|
||||
assert.equal(a.body.workspace.namespace, undefined);
|
||||
assert.equal((await f.call(null, '/api/workspace')).status, 401);
|
||||
const owner = await f.call('owner', '/api/workspace');
|
||||
assert.equal(owner.status, 409);
|
||||
assert.equal((await f.call('readonly', '/api/workspace')).body.workspace.canWriteProducts, false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user