@substrat-run/contract-tests 0.178.0 → 0.179.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-host-suite.d.ts","sourceRoot":"","sources":["../src/scope-host-suite.ts"],"names":[],"mappings":"AAEA,OAAO,EAuBL,KAAK,SAAS,EAyBf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAsBL,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAe9B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,oGAAoG;AACpG,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG;IAC5C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAChF,CAAC,GACD,IAAI,CA+GN;AAuCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,MACrB,OAAO,CAAC,OAAO,CAAC,QACb,SAAS,YACL,MAAM,KACf,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAC5C,IAAI,GAAE,qBAA0B,GAC/B,IAAI,
|
|
1
|
+
{"version":3,"file":"scope-host-suite.d.ts","sourceRoot":"","sources":["../src/scope-host-suite.ts"],"names":[],"mappings":"AAEA,OAAO,EAuBL,KAAK,SAAS,EAyBf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAsBL,KAAK,SAAS,EAEf,MAAM,sBAAsB,CAAC;AAe9B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,oGAAoG;AACpG,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,GAAG;IAC5C,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CAChF,CAAC,GACD,IAAI,CA+GN;AAuCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,MACrB,OAAO,CAAC,OAAO,CAAC,QACb,SAAS,YACL,MAAM,KACf,OAAO,CAAC,IAAI,CAOd,CAAC;AAEF,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAC5C,IAAI,GAAE,qBAA0B,GAC/B,IAAI,CAo7YN"}
|
package/dist/scope-host-suite.js
CHANGED
|
@@ -1556,6 +1556,36 @@ export function scopeHostContractSuite(adapterName, makeFixture, opts = {}) {
|
|
|
1556
1556
|
const provisioned = (await host.admin.auditLog(staff, { tenantId: t })).find((r) => r.action === 'provisionScope' && r.scopeId === sc);
|
|
1557
1557
|
expect(provisioned?.onBehalfOf).toEqual({ principal: person, tenantId: t });
|
|
1558
1558
|
});
|
|
1559
|
+
it('an attributed host names the person on its access rows too, co-located and delegated (#2860)', async () => {
|
|
1560
|
+
const t = tenantId.parse(ulid());
|
|
1561
|
+
await host.admin.createTenant(staff, { id: t, slug: 'access-attribution', name: 'Access attribution' });
|
|
1562
|
+
await host.admin.registerIdentityPool(staff, { provider: 'oidc:access-attribution', topology: 'central', tenantId: null });
|
|
1563
|
+
const person = principalId.parse(ulid());
|
|
1564
|
+
const impersonator = platformActorId.parse(ulid());
|
|
1565
|
+
// Impersonated, so the K-42 stamp is held to the round trip too, as the admin log's twin is.
|
|
1566
|
+
const onBehalfOf = { principal: person, tenantId: t, impersonation: { session: 'imp-2860', by: impersonator } };
|
|
1567
|
+
const sc = scopeId.parse(ulid());
|
|
1568
|
+
const delegated = { method: 'readScopeTable', tenantId: t, scopeId: sc, params: null, resultCount: 0 };
|
|
1569
|
+
const viewed = host.attributed(onBehalfOf).admin;
|
|
1570
|
+
await viewed.getTenant(staff, t);
|
|
1571
|
+
await viewed.recordDelegatedRead(staff, delegated);
|
|
1572
|
+
// The one access row the control plane writes on the host's behalf rather than through
|
|
1573
|
+
// its own `recordAccess` (the hosted directory's identity read).
|
|
1574
|
+
await viewed.listIdentityMemberships(staff, 'oidc:access-attribution', `ext-${t}`);
|
|
1575
|
+
await host.admin.getTenant(staff, t);
|
|
1576
|
+
await host.admin.recordDelegatedRead(staff, delegated);
|
|
1577
|
+
const rows = (await host.admin.accessLog(staff, { tenantId: t }))
|
|
1578
|
+
.filter((r) => r.method === 'getTenant' || r.method === 'readScopeTable');
|
|
1579
|
+
expect(rows.map((r) => [r.method, r.onBehalfOf ?? null])).toEqual([
|
|
1580
|
+
['getTenant', onBehalfOf],
|
|
1581
|
+
['readScopeTable', onBehalfOf],
|
|
1582
|
+
['getTenant', null],
|
|
1583
|
+
['readScopeTable', null],
|
|
1584
|
+
]);
|
|
1585
|
+
const memberships = (await host.admin.accessLog(staff, { method: 'listIdentityMemberships' }))
|
|
1586
|
+
.filter((r) => r.method === 'listIdentityMemberships' && r.onBehalfOf?.principal === person);
|
|
1587
|
+
expect(memberships.map((r) => r.onBehalfOf)).toEqual([onBehalfOf]);
|
|
1588
|
+
});
|
|
1559
1589
|
it('isolates scope storage: a write in one scope is invisible in another', async () => {
|
|
1560
1590
|
const stub1 = await host.getScope(alice, t1, s1);
|
|
1561
1591
|
const stub2 = await host.getScope(alice, t2, s2);
|