@wildo-ai/platform-infra-providers 1.1.13 → 1.1.15

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildo-ai/platform-infra-providers",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "Concrete InfraProviderModule catalog (RabbitMQ_Self, Redis_Self, Postgres_Self, MongoDB_Atlas, MongoDB_Self) — tier-portable, importable by both platform-apps-manager (orchestrator) and wildo-cli (lockfile materializer). Slice 2.5c-1 of infra-provider-planner.md.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Wildo AI",
@@ -30,10 +30,10 @@
30
30
  "test:watch": "vitest"
31
31
  },
32
32
  "dependencies": {
33
- "@wildo-ai/platform-config-lib": "1.1.13"
33
+ "@wildo-ai/platform-config-lib": "1.1.15"
34
34
  },
35
35
  "peerDependencies": {
36
- "zod": "^4.6.6"
36
+ "zod": "^4.6.7"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@swc/core": "^1.15.13",
@@ -26,7 +26,7 @@ import {
26
26
  InfraPlatformAdminConsumer,
27
27
  InfraProvider,
28
28
  } from '@wildo-ai/platform-config-lib';
29
- import { ApplicationRuntimePrincipalKind } from '@wildo-ai/platform-config-lib';
29
+ import { ApplicationRuntimePrincipalKind, deriveMinionDatabaseQueueConfinement } from '@wildo-ai/platform-config-lib';
30
30
  import { PostgresSelfInfraProviderModule } from '../postgres-self.infra.module';
31
31
 
32
32
  function makeAdminClientStub(
@@ -303,6 +303,28 @@ describe('PostgresSelfInfraProviderModule — per-principal table-scoped role',
303
303
  expect(call.schemaName).toBe('public');
304
304
  });
305
305
 
306
+ // #2303. Mutation: drop the confinement → a minion cannot reach the DATABASE queue under `small`; pass it for every
307
+ // named principal → a worker gains a queue table it never consumes.
308
+ it('confines a MINION to its own rows of the DATABASE queue, and gives no other principal that table', async () => {
309
+ const adminClient = makeAdminClientStub();
310
+ await PostgresSelfInfraProviderModule.mintAppCredentials!(makeMintContext(adminClient, {
311
+ principal: minionPrincipal,
312
+ resourceGrants: { read: [] as never, write: [] as never },
313
+ }));
314
+ const [call] = adminClient.upsertTableScopedDatabaseRoleSpy.mock.calls[0]!;
315
+ const queue = deriveMinionDatabaseQueueConfinement('60d21bdf1c4ae5cda1b2c3d4', 'marketingScrapper');
316
+ expect(call.rowConfinedTables).toEqual([{ table: 'queueMessages', column: 'queueName', rowsReachable: queue.rowsReachable }]);
317
+ // The queue table is never on a plain axis: a plain grant there would reach every queue of the application.
318
+ for (const axis of [call.readTables, call.writeTables, call.appendTables, call.maintainTables]) expect(axis).not.toContain('queueMessages');
319
+
320
+ const worker = makeAdminClientStub();
321
+ await PostgresSelfInfraProviderModule.mintAppCredentials!(makeMintContext(worker, {
322
+ principal: { kind: ApplicationRuntimePrincipalKind.WORKER, name: 'thumbnails' } as AppCredentialMintingContext['principal'],
323
+ resourceGrants: { read: [] as never, write: [] as never },
324
+ }));
325
+ expect(worker.upsertTableScopedDatabaseRoleSpy.mock.calls[0]![0].rowConfinedTables).toEqual([]);
326
+ });
327
+
306
328
  it('REFUSES an omitted resolved grant contract instead of falling back to the database owner', async () => {
307
329
  // The dangerous alternative is not an exception — it is silently falling
308
330
  // through to `upsertApplicationDatabase`, which would hand the minion
@@ -79,7 +79,9 @@ import {
79
79
  ApplicationRuntimePrincipal,
80
80
  ApplicationRuntimePrincipalKind,
81
81
  deriveMinionDatabaseGrants,
82
+ deriveMinionDatabaseQueueConfinement,
82
83
  resolveGrantStorageNames,
84
+ type PostgresRowConfinedTableGrant,
83
85
  } from '@wildo-ai/platform-config-lib';
84
86
 
85
87
  /**
@@ -297,6 +299,17 @@ export const PostgresSelfInfraProviderModule: InfraProviderModule = {
297
299
  // about what that floor is.
298
300
  const databaseGrants = deriveMinionDatabaseGrants(grants);
299
301
 
302
+ // #2303: a MINION reaches the DATABASE queue's table, confined by row-level security to its own queues. Granted
303
+ // under every service profile, because a profile is not the role's to know. Under `full` the table is unused, so the
304
+ // only reach this adds there is publishing into an empty queue nobody consumes, and reading its own (empty) queues.
305
+ // Only minions: no other named principal consumes that queue.
306
+ const rowConfinedTables: PostgresRowConfinedTableGrant[] = [];
307
+ if (context.principal.kind === ApplicationRuntimePrincipalKind.MINION) {
308
+ const queue = deriveMinionDatabaseQueueConfinement(context.wildoApplicationId, context.principal.name ?? '');
309
+ const [table] = resolveGrantStorageNames([queue.resourceType]);
310
+ rowConfinedTables.push({ table, column: queue.field, rowsReachable: queue.rowsReachable });
311
+ }
312
+
300
313
  const { connectionUrl: principalConnectionUrl } = await adminClient.upsertTableScopedDatabaseRole({
301
314
  databaseName,
302
315
  username,
@@ -312,6 +325,7 @@ export const PostgresSelfInfraProviderModule: InfraProviderModule = {
312
325
  writeTables: resolveGrantStorageNames(databaseGrants.write),
313
326
  appendTables: resolveGrantStorageNames(databaseGrants.append),
314
327
  maintainTables: resolveGrantStorageNames(databaseGrants.maintain),
328
+ rowConfinedTables,
315
329
  });
316
330
 
317
331
  return {