@opengeni/db 4.4.0-canary.2 → 5.0.0-canary.1

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.
Files changed (50) hide show
  1. package/dist/artifact-catalog.d.ts +41 -0
  2. package/dist/canonical-human-identities.js +3 -3
  3. package/dist/{chunk-M4PKBJRS.js → chunk-6T2GGYWE.js} +4 -4
  4. package/dist/{chunk-2KOLL33E.js → chunk-7HMK3B45.js} +2 -2
  5. package/dist/{chunk-WFU6PS54.js → chunk-DPONPYJD.js} +2 -2
  6. package/dist/{chunk-6IJD3XXF.js → chunk-ERKVSPDX.js} +3 -3
  7. package/dist/{chunk-5UUWZDAV.js → chunk-F73UKJY6.js} +31 -1
  8. package/dist/{chunk-5UUWZDAV.js.map → chunk-F73UKJY6.js.map} +1 -1
  9. package/dist/{chunk-6V3HDEMR.js → chunk-HQDVI2DB.js} +2 -2
  10. package/dist/{chunk-UOXWVP3T.js → chunk-MWMXWHJD.js} +2 -2
  11. package/dist/{chunk-CHBLBEU6.js → chunk-T6BWIGWJ.js} +2 -2
  12. package/dist/{chunk-XJP7KJ6U.js → chunk-T6YLHJLS.js} +47 -3
  13. package/dist/chunk-T6YLHJLS.js.map +1 -0
  14. package/dist/editable-artifact-durable-export.js +2 -2
  15. package/dist/editable-artifacts.js +3 -3
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +1893 -1812
  18. package/dist/index.js.map +1 -1
  19. package/dist/managed-auth-session-sets.js +3 -3
  20. package/dist/mcp-operations.js +2 -2
  21. package/dist/provision-roles.js +1 -1
  22. package/dist/retained-provider-commands.js +2 -2
  23. package/dist/runtime-posture.d.ts +2 -0
  24. package/dist/schema.d.ts +93 -0
  25. package/dist/schema.js +3 -1
  26. package/dist/session-background-commands.js +4 -4
  27. package/dist/session-command-output.js +4 -4
  28. package/dist/session-event-slices.js +2 -2
  29. package/dist/session-mcp-credential-rotation.js +4 -4
  30. package/dist/session-tenancy.js +3 -3
  31. package/dist/video-generation.js +3 -3
  32. package/dist/workspace-tool-defaults.js +4 -4
  33. package/drizzle/0465_sandbox_file_publications.sql +142 -0
  34. package/drizzle/0466_agent_instruction_activation_preservation.sql +190 -0
  35. package/drizzle/0467_host_resolver_full_organization_keys.sql +34 -0
  36. package/package.json +6 -6
  37. package/src/artifact-catalog.ts +121 -0
  38. package/src/host-mcp-resolvers.ts +1 -1
  39. package/src/index.ts +1 -0
  40. package/src/provision-roles.ts +6 -0
  41. package/src/runtime-posture.ts +54 -1
  42. package/src/schema.ts +30 -0
  43. package/dist/chunk-XJP7KJ6U.js.map +0 -1
  44. /package/dist/{chunk-M4PKBJRS.js.map → chunk-6T2GGYWE.js.map} +0 -0
  45. /package/dist/{chunk-2KOLL33E.js.map → chunk-7HMK3B45.js.map} +0 -0
  46. /package/dist/{chunk-WFU6PS54.js.map → chunk-DPONPYJD.js.map} +0 -0
  47. /package/dist/{chunk-6IJD3XXF.js.map → chunk-ERKVSPDX.js.map} +0 -0
  48. /package/dist/{chunk-6V3HDEMR.js.map → chunk-HQDVI2DB.js.map} +0 -0
  49. /package/dist/{chunk-UOXWVP3T.js.map → chunk-MWMXWHJD.js.map} +0 -0
  50. /package/dist/{chunk-CHBLBEU6.js.map → chunk-T6BWIGWJ.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  rawRows,
3
3
  withRlsContext
4
- } from "./chunk-WFU6PS54.js";
4
+ } from "./chunk-DPONPYJD.js";
5
5
 
6
6
  // src/editable-artifacts.ts
7
7
  import { createHash } from "crypto";
@@ -3540,4 +3540,4 @@ export {
3540
3540
  PostgresEditableArtifactStore,
3541
3541
  PostgresEditableArtifactLiveReadStore
3542
3542
  };
3543
- //# sourceMappingURL=chunk-6V3HDEMR.js.map
3543
+ //# sourceMappingURL=chunk-HQDVI2DB.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  nestedPostgresSqlState,
3
3
  rawRows
4
- } from "./chunk-WFU6PS54.js";
4
+ } from "./chunk-DPONPYJD.js";
5
5
 
6
6
  // src/managed-auth-session-sets.ts
7
7
  import {
@@ -296,4 +296,4 @@ export {
296
296
  reapManagedAuthIsolatedSessions,
297
297
  reapExpiredManagedAuthSessionSets
298
298
  };
299
- //# sourceMappingURL=chunk-UOXWVP3T.js.map
299
+ //# sourceMappingURL=chunk-MWMXWHJD.js.map
@@ -5,7 +5,7 @@ import {
5
5
  withWorkspaceRls,
6
6
  withWorkspaceSubjectRls,
7
7
  withWorkspaceSubjectSessionActivityRls
8
- } from "./chunk-WFU6PS54.js";
8
+ } from "./chunk-DPONPYJD.js";
9
9
 
10
10
  // src/session-tenancy.ts
11
11
  import { createHash } from "crypto";
@@ -502,4 +502,4 @@ export {
502
502
  forkSessionContent,
503
503
  replayAppliedSessionFork
504
504
  };
505
- //# sourceMappingURL=chunk-CHBLBEU6.js.map
505
+ //# sourceMappingURL=chunk-T6BWIGWJ.js.map
@@ -122,6 +122,11 @@ var AUTOMATIC_SESSION_TITLE_FANOUT_RUNTIME_ROUTINES = [
122
122
  var AUTOMATIC_SESSION_TITLE_FANOUT_MIGRATION_ROUTINE = "enqueue_automatic_session_title_fanout_v1(uuid, uuid, uuid, uuid)";
123
123
  var AUTOMATIC_SESSION_TITLE_POLICY_TRIGGER_ROUTINE = "enforce_automatic_session_title_policy_v1()";
124
124
  var AUTOMATIC_SESSION_TITLE_FANOUT_OUTBOX_TABLE = "automatic_session_title_fanout_outbox_v1";
125
+ var SANDBOX_FILE_PUBLICATION_RUNTIME_ROUTINES = [
126
+ "record_sandbox_file_publication(uuid, uuid, uuid, uuid)",
127
+ "list_sandbox_file_publications(uuid, uuid, jsonb)"
128
+ ];
129
+ var SANDBOX_FILE_PUBLICATIONS_TABLE = "sandbox_file_publications";
125
130
  var AUTOMATIC_SESSION_TITLE_QUARANTINE_FENCE_ROUTINE = "acquire_automatic_session_title_quarantine_fences_v1(integer)";
126
131
  var MCP_OPERATION_CAPABILITY_ROUTINE = "mcp_operation_command(jsonb, text, jsonb)";
127
132
  var MCP_OPERATION_AUTHORITY_TABLES = [
@@ -1767,6 +1772,7 @@ async function inspectRuntimeDatabasePosture(db, options) {
1767
1772
  ${DOCUMENT_MIGRATION_CAPABILITY_TABLE},
1768
1773
  ${SCOPED_COMPUTE_CAPABILITY_TABLE},
1769
1774
  ${CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE},
1775
+ ${SANDBOX_FILE_PUBLICATIONS_TABLE},
1770
1776
  ${AUTOMATIC_SESSION_TITLE_FANOUT_OUTBOX_TABLE}
1771
1777
  )
1772
1778
  `)
@@ -1828,7 +1834,8 @@ async function inspectRuntimeDatabasePosture(db, options) {
1828
1834
  from aclexplode(coalesce(p.proacl, acldefault('f', p.proowner))) acl
1829
1835
  where acl.grantee = 0 and acl.privilege_type = 'EXECUTE'
1830
1836
  ) as public_execute,
1831
- p.prosecdef as security_definer
1837
+ p.prosecdef as security_definer,
1838
+ p.proconfig as configuration
1832
1839
  from pg_proc p
1833
1840
  join pg_namespace n on n.oid = p.pronamespace
1834
1841
  where n.nspname = 'opengeni_private'
@@ -1840,7 +1847,8 @@ async function inspectRuntimeDatabasePosture(db, options) {
1840
1847
  owner: row.owner,
1841
1848
  execute: row.can_execute,
1842
1849
  publicExecute: row.public_execute,
1843
- securityDefiner: row.security_definer
1850
+ securityDefiner: row.security_definer,
1851
+ configuration: row.configuration
1844
1852
  }));
1845
1853
  return {
1846
1854
  identity: mappedIdentity,
@@ -3205,6 +3213,35 @@ function evaluateRuntimeDatabasePosture(posture, options) {
3205
3213
  );
3206
3214
  }
3207
3215
  }
3216
+ const publicationTables = posture.privateTables.filter(
3217
+ (table) => table.name === SANDBOX_FILE_PUBLICATIONS_TABLE
3218
+ );
3219
+ if (publicationTables.length !== 1) {
3220
+ if (!options.protectedTables)
3221
+ violations.push("sandbox file publication private relation is missing or ambiguous");
3222
+ } else {
3223
+ const table = publicationTables[0];
3224
+ if (!table.rlsEnabled || !table.rlsForced || !table.rlsActive || (table.policyCount ?? 0) < 2) {
3225
+ violations.push("sandbox file publication relation lacks active FORCE-RLS file isolation");
3226
+ }
3227
+ if (table.select || table.insert || table.update || table.delete || table.owner === expectedRole) {
3228
+ violations.push("runtime role has forbidden direct sandbox file publication authority");
3229
+ }
3230
+ const filesOwner = tableByName.get("files")?.owner;
3231
+ if (filesOwner && table.owner !== filesOwner)
3232
+ violations.push("sandbox file publication owner does not match file authority");
3233
+ for (const name of SANDBOX_FILE_PUBLICATION_RUNTIME_ROUTINES) {
3234
+ const routines = posture.privateRoutines.filter((routine) => routine.name === name);
3235
+ const quotedSchema = `"${targetSchema.replaceAll('"', '""')}"`;
3236
+ const searchPaths = /* @__PURE__ */ new Set([
3237
+ `search_path=pg_catalog, ${quotedSchema}, pg_temp`,
3238
+ `search_path=pg_catalog, ${/^[a-z_][a-z0-9_]*$/.test(targetSchema) ? targetSchema : quotedSchema}, pg_temp`
3239
+ ]);
3240
+ if (routines.length !== 1 || !routines[0].execute || routines[0].publicExecute || !routines[0].securityDefiner || routines[0].owner !== table.owner || !routines[0].configuration?.some((configuration) => searchPaths.has(configuration))) {
3241
+ violations.push(`sandbox file publication capability ${name} is missing or unsafe`);
3242
+ }
3243
+ }
3244
+ }
3208
3245
  for (const routine of posture.privateRoutines) {
3209
3246
  if (routine.owner === expectedRole) {
3210
3247
  violations.push(`runtime role owns private routine ${routine.name}`);
@@ -5151,6 +5188,12 @@ BEGIN
5151
5188
  EXECUTE format('GRANT USAGE ON SCHEMA opengeni_private TO %I', ${literal(role)});
5152
5189
  EXECUTE format('REVOKE CREATE ON SCHEMA opengeni_private FROM %I', ${literal(role)});
5153
5190
  EXECUTE format('GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA opengeni_private TO %I', ${literal(role)});
5191
+ IF to_regclass('opengeni_private.sandbox_file_publications') IS NOT NULL THEN
5192
+ EXECUTE format('REVOKE ALL ON TABLE opengeni_private.sandbox_file_publications FROM %I', ${literal(role)});
5193
+ REVOKE ALL ON TABLE opengeni_private.sandbox_file_publications FROM PUBLIC;
5194
+ REVOKE ALL ON FUNCTION opengeni_private.record_sandbox_file_publication(uuid,uuid,uuid,uuid) FROM PUBLIC;
5195
+ REVOKE ALL ON FUNCTION opengeni_private.list_sandbox_file_publications(uuid,uuid,jsonb) FROM PUBLIC;
5196
+ END IF;
5154
5197
  FOREACH routine_signature IN ARRAY ARRAY[
5155
5198
  'guard_mcp_operation_immutable()',
5156
5199
  'mcp_operation_command_scoped(jsonb,text,jsonb)',
@@ -5367,6 +5410,7 @@ if (import.meta.main) {
5367
5410
  }
5368
5411
 
5369
5412
  export {
5413
+ SANDBOX_FILE_PUBLICATION_RUNTIME_ROUTINES,
5370
5414
  WORK_CLAIM_CAPABILITY_ROUTINES,
5371
5415
  RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES,
5372
5416
  RUNTIME_TARGET_SCHEMA_PUBLIC_POLICY_PREDICATE_ROUTINES,
@@ -5389,4 +5433,4 @@ export {
5389
5433
  runtimeDatabaseReadyCheck,
5390
5434
  provisionRoles
5391
5435
  };
5392
- //# sourceMappingURL=chunk-XJP7KJ6U.js.map
5436
+ //# sourceMappingURL=chunk-T6YLHJLS.js.map