Protect Studio catalog images and expose canonical workspace bootstrap

This commit is contained in:
khondokartowsif171
2026-10-18 22:53:29 +06:00
parent cbe6e0ae94
commit 07f711ff2d
6 changed files with 178 additions and 5 deletions
+15
View File
@@ -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);
});