@opengeni/db 5.0.1 → 6.0.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.
- package/dist/automations.d.ts +0 -2
- package/dist/canonical-human-identities.d.ts +4 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-components.d.ts +5 -13
- package/dist/capability-integrations.d.ts +23 -8
- package/dist/capability-reconciliation.d.ts +5 -0
- package/dist/capability-reconciliation.js +21 -0
- package/dist/capability-reconciliation.js.map +1 -0
- package/dist/{chunk-6T2GGYWE.js → chunk-4UJCXBR2.js} +4 -5800
- package/dist/chunk-4UJCXBR2.js.map +1 -0
- package/dist/{chunk-MWMXWHJD.js → chunk-7JCDSMX2.js} +2 -2
- package/dist/chunk-AJA2ZIUW.js +219 -0
- package/dist/chunk-AJA2ZIUW.js.map +1 -0
- package/dist/chunk-CDAT6EKW.js +247 -0
- package/dist/chunk-CDAT6EKW.js.map +1 -0
- package/dist/{chunk-DPONPYJD.js → chunk-CJI6G254.js} +70 -18
- package/dist/chunk-CJI6G254.js.map +1 -0
- package/dist/chunk-G32NVMRJ.js +276 -0
- package/dist/chunk-G32NVMRJ.js.map +1 -0
- package/dist/chunk-GABXCG3N.js +5811 -0
- package/dist/chunk-GABXCG3N.js.map +1 -0
- package/dist/{chunk-ERKVSPDX.js → chunk-LVY33EWL.js} +3 -3
- package/dist/{chunk-45CP2YKY.js → chunk-MAMBI2HR.js} +9 -3
- package/dist/{chunk-45CP2YKY.js.map → chunk-MAMBI2HR.js.map} +1 -1
- package/dist/{chunk-F73UKJY6.js → chunk-MN5PZMEK.js} +91 -108
- package/dist/chunk-MN5PZMEK.js.map +1 -0
- package/dist/chunk-PJI4MUZ7.js +131 -0
- package/dist/chunk-PJI4MUZ7.js.map +1 -0
- package/dist/{chunk-T6BWIGWJ.js → chunk-RIYHP2WU.js} +2 -2
- package/dist/{chunk-7HMK3B45.js → chunk-RL2MUXM3.js} +16 -7
- package/dist/chunk-RL2MUXM3.js.map +1 -0
- package/dist/{chunk-HQDVI2DB.js → chunk-SYKHLPTK.js} +4 -3
- package/dist/{chunk-HQDVI2DB.js.map → chunk-SYKHLPTK.js.map} +1 -1
- package/dist/{chunk-T6YLHJLS.js → chunk-XIXVVBW2.js} +198 -51
- package/dist/chunk-XIXVVBW2.js.map +1 -0
- package/dist/chunk-ZPJ6V2VG.js +156 -0
- package/dist/chunk-ZPJ6V2VG.js.map +1 -0
- package/dist/codex-capacity-recovery.d.ts +12 -0
- package/dist/codex-failure-eligibility.d.ts +9 -0
- package/dist/company-profile-schema.d.ts +4 -2
- package/dist/connect-attempts.d.ts +15 -0
- package/dist/connect-attempts.js +25 -0
- package/dist/connect-attempts.js.map +1 -0
- package/dist/connection-authority.d.ts +7 -63
- package/dist/connection-refresh-lock.d.ts +4 -0
- package/dist/connection-token-resolver.d.ts +8 -43
- package/dist/database-timing.d.ts +10 -0
- package/dist/database.d.ts +4 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.d.ts +9 -0
- package/dist/editable-artifacts.js +7 -5
- package/dist/index.d.ts +447 -78
- package/dist/index.js +12705 -12872
- package/dist/index.js.map +1 -1
- package/dist/insights-usage-bundle.d.ts +3 -0
- package/dist/integration-bindings.d.ts +1 -1
- package/dist/integration-facets.d.ts +18 -1
- package/dist/knowledge-entries-schema.d.ts +2 -0
- package/dist/knowledge-entries.d.ts +1 -0
- package/dist/knowledge-indexing.d.ts +1 -0
- package/dist/live-session-attempt.d.ts +35 -137
- package/dist/managed-auth-session-sets.js +3 -3
- package/dist/mcp-account-bindings.d.ts +4 -0
- package/dist/mcp-oauth.d.ts +11 -0
- package/dist/mcp-operations.js +2 -2
- package/dist/migrate.js +1 -1
- package/dist/organization-integration-policy.d.ts +51 -0
- package/dist/organization-integration-policy.js +18 -0
- package/dist/organization-integration-policy.js.map +1 -0
- package/dist/organization-usage.d.ts +20 -0
- package/dist/plugin-packages.d.ts +9 -12
- package/dist/pr-review.d.ts +0 -11
- package/dist/preference-registry-schema.d.ts +17 -0
- package/dist/provision-roles.js +1 -1
- package/dist/retained-provider-commands.d.ts +124 -6
- package/dist/retained-provider-commands.js +29 -97
- package/dist/retained-provider-commands.js.map +1 -1
- package/dist/retired-session-create-metadata.d.ts +4 -0
- package/dist/runtime-posture.d.ts +7 -5
- package/dist/schema.d.ts +876 -656
- package/dist/schema.js +5 -7
- package/dist/session-admission-block.d.ts +32 -0
- package/dist/session-attempt-writers.d.ts +4 -0
- package/dist/session-background-commands.js +5 -4
- package/dist/session-command-output.js +8 -126
- package/dist/session-command-output.js.map +1 -1
- package/dist/session-control.d.ts +5 -1
- package/dist/session-event-slices.d.ts +10 -0
- package/dist/session-event-slices.js +8 -222
- package/dist/session-event-slices.js.map +1 -1
- package/dist/session-file-attachments.d.ts +28 -0
- package/dist/session-goal-reports.d.ts +43 -0
- package/dist/session-mcp-approval.d.ts +4 -0
- package/dist/session-mcp-credential-rotation.js +5 -4
- package/dist/session-mcp-credential-rotation.js.map +1 -1
- package/dist/session-message-search.d.ts +22 -0
- package/dist/session-queue-commands.d.ts +2 -6
- package/dist/session-retry.d.ts +36 -0
- package/dist/session-tenancy.js +3 -3
- package/dist/skill-source-release-impact.d.ts +18 -0
- package/dist/skill-source-release.d.ts +9 -0
- package/dist/skills.d.ts +7 -1
- package/dist/user-resource-authority.d.ts +0 -8
- package/dist/video-generation.js +3 -3
- package/dist/workspace-tool-defaults.js +5 -4
- package/dist/workspace-tool-defaults.js.map +1 -1
- package/drizzle/0468_knowledge_relationship_projection.sql +30 -0
- package/drizzle/0469_knowledge_source_discovery.sql +85 -0
- package/drizzle/0470_organization_integration_policy.sql +151 -0
- package/drizzle/0471_usage_events_account_recent_index.sql +4 -0
- package/drizzle/0472_usage_events_workspace_recent_index.sql +4 -0
- package/drizzle/0473_organization_usage_analytical_capability.sql +237 -0
- package/drizzle/0474_goal_report_requirements.sql +156 -0
- package/drizzle/0475_session_event_history_statistics.sql +15 -0
- package/drizzle/0476_session_event_history_policy_planning.sql +29 -0
- package/drizzle/0477_managed_sign_in_methods.sql +303 -0
- package/drizzle/0478_sender_owned_connections.sql +2772 -0
- package/drizzle/0479_connection_create_idempotency.sql +16 -0
- package/drizzle/0480_private_session_organization_key_administration.sql +154 -0
- package/drizzle/0481_personal_connection_visibility_cleanup.sql +45 -0
- package/drizzle/0482_remove_packs.sql +417 -0
- package/drizzle/0483_preclaim_admission_block.sql +85 -0
- package/drizzle/0484_insights_usage_projection.sql +211 -0
- package/drizzle/0485_inherited_mcp_approval_policies.sql +6 -0
- package/drizzle/0486_reasoning_configuration_message_forks.sql +35 -0
- package/drizzle/0487_skill_catalog_message_forks.sql +26 -0
- package/drizzle/0488_permanent_skill_removal.sql +207 -0
- package/drizzle/0489_modal_command_byte_offsets.sql +17 -0
- package/drizzle/0490_periodic_capture_attempt_cadence.sql +6 -0
- package/drizzle/0491_warm_capture_holder_reclamation.sql +57 -0
- package/drizzle/0492_codex_accepted_source_authority.sql +249 -0
- package/drizzle/0493_stopping_command_error_containment.sql +58 -0
- package/drizzle/0494_mcp_account_bindings.sql +334 -0
- package/drizzle/0495_consented_sandbox_recovery.sql +220 -0
- package/drizzle/0496_supervised_command_settlement.sql +386 -0
- package/drizzle/0497_modal_inventory_owner_read_capability.sql +112 -0
- package/drizzle/0498_enrollment_membership_fence.sql +87 -0
- package/drizzle/0499_session_attachment_access.sql +224 -0
- package/drizzle/0500_session_execution_epoch.sql +37 -0
- package/drizzle/0501_session_sharing_execution.sql +591 -0
- package/drizzle/0502_active_message_boundary_forks.sql +30 -0
- package/package.json +17 -5
- package/src/automations.ts +17 -73
- package/src/canonical-human-identities.ts +17 -5
- package/src/capability-components.ts +7 -24
- package/src/capability-integrations.ts +301 -21
- package/src/capability-reconciliation.ts +19 -0
- package/src/codex-capacity-recovery.ts +47 -0
- package/src/codex-failure-eligibility.ts +93 -0
- package/src/connect-attempts.ts +49 -18
- package/src/connection-authority.ts +12 -158
- package/src/connection-refresh-lock.ts +22 -0
- package/src/connection-token-resolver.ts +58 -530
- package/src/database-timing.ts +43 -0
- package/src/database.ts +61 -26
- package/src/editable-artifacts.ts +1 -1
- package/src/index.ts +3578 -1273
- package/src/insights-model-bundle.ts +19 -7
- package/src/insights-usage-bundle.ts +16 -19
- package/src/integration-bindings.ts +2 -7
- package/src/integration-facets.ts +73 -6
- package/src/knowledge-entries.ts +8 -1
- package/src/live-session-attempt.ts +0 -22
- package/src/mcp-account-bindings.ts +12 -0
- package/src/mcp-oauth.ts +26 -0
- package/src/organization-integration-policy.ts +235 -0
- package/src/organization-usage.ts +83 -0
- package/src/plugin-packages.ts +226 -42
- package/src/pr-review.ts +7 -69
- package/src/preference-registry-schema.ts +1 -0
- package/src/provision-roles.ts +50 -37
- package/src/retained-provider-commands.ts +286 -9
- package/src/retired-session-create-metadata.ts +16 -0
- package/src/runtime-posture.ts +217 -13
- package/src/schema.ts +104 -120
- package/src/session-admission-block.ts +29 -0
- package/src/session-attempt-writers.ts +48 -0
- package/src/session-control.ts +21 -5
- package/src/session-event-slices.ts +76 -26
- package/src/session-file-attachments.ts +66 -0
- package/src/session-goal-reports.ts +255 -0
- package/src/session-mcp-approval.ts +30 -0
- package/src/session-message-search.ts +348 -0
- package/src/session-queue-commands.ts +60 -36
- package/src/session-retry.ts +319 -0
- package/src/skill-config-migration.ts +11 -2
- package/src/skill-source-release-impact.ts +33 -0
- package/src/skill-source-release.ts +67 -26
- package/src/skills.ts +44 -6
- package/src/user-resource-authority.ts +0 -56
- package/dist/chunk-6T2GGYWE.js.map +0 -1
- package/dist/chunk-7HMK3B45.js.map +0 -1
- package/dist/chunk-DPONPYJD.js.map +0 -1
- package/dist/chunk-F73UKJY6.js.map +0 -1
- package/dist/chunk-T6YLHJLS.js.map +0 -1
- package/dist/host-mcp-binding-match.d.ts +0 -5
- package/dist/host-mcp-bindings.d.ts +0 -79
- package/dist/host-mcp-resolvers.d.ts +0 -47
- package/dist/host-mcp-task-authority.d.ts +0 -43
- package/dist/host-selection-identity.d.ts +0 -6
- package/dist/pack-components.d.ts +0 -83
- package/dist/pack-installations.d.ts +0 -86
- package/src/host-mcp-binding-match.ts +0 -34
- package/src/host-mcp-bindings.ts +0 -777
- package/src/host-mcp-resolvers.ts +0 -266
- package/src/host-mcp-task-authority.ts +0 -384
- package/src/host-selection-identity.ts +0 -29
- package/src/pack-components.ts +0 -980
- package/src/pack-installations.ts +0 -950
- /package/dist/{chunk-MWMXWHJD.js.map → chunk-7JCDSMX2.js.map} +0 -0
- /package/dist/{chunk-ERKVSPDX.js.map → chunk-LVY33EWL.js.map} +0 -0
- /package/dist/{chunk-T6BWIGWJ.js.map → chunk-RIYHP2WU.js.map} +0 -0
package/src/runtime-posture.ts
CHANGED
|
@@ -72,6 +72,9 @@ const MCP_OPERATION_AUTHORITY_TABLES = [
|
|
|
72
72
|
"scheduled_task_runs",
|
|
73
73
|
] as const;
|
|
74
74
|
const OWNER_INTERNAL_PRIVATE_ROUTINES = new Set<string>([
|
|
75
|
+
"read_sender_connection(uuid, uuid, uuid, text)",
|
|
76
|
+
"validate_mcp_account_bindings(jsonb, jsonb)",
|
|
77
|
+
"fence_mcp_account_bindings()",
|
|
75
78
|
"guard_mcp_operation_immutable()",
|
|
76
79
|
"mcp_operation_command_scoped(jsonb, text, jsonb)",
|
|
77
80
|
"guard_workspace_owned_skill_head_delete()",
|
|
@@ -124,6 +127,7 @@ const ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES = [
|
|
|
124
127
|
"get_organization_administration_overview(uuid, text)",
|
|
125
128
|
"get_workspace_kind(uuid, uuid)",
|
|
126
129
|
"resolve_workspace_codex_subscription_source(uuid, uuid)",
|
|
130
|
+
"capture_legacy_codex_turn_sources(uuid, uuid)",
|
|
127
131
|
"list_organization_workspace_ids(uuid)",
|
|
128
132
|
"list_organization_codex_workspace_ids(uuid)",
|
|
129
133
|
"organization_workspace_command(jsonb)",
|
|
@@ -252,10 +256,10 @@ const MANAGED_HUMAN_PERSONAL_WORKSPACE_AUTHORITY_TABLES = [
|
|
|
252
256
|
const PERSONAL_RESOURCE_ATTEMPT_RESOLVER_ROUTINE =
|
|
253
257
|
"resolve_session_attempt_personal_resources(uuid, uuid, uuid)";
|
|
254
258
|
const USER_RESOURCE_LIFECYCLE_ROUTINES = [
|
|
259
|
+
"list_owned_connection_accounts(uuid, uuid)",
|
|
255
260
|
"accept_turn_personal_resource_attachment(uuid, uuid, uuid, uuid, text, integer, boolean, integer)",
|
|
256
261
|
"list_self_user_resource_authorities(uuid, uuid, text, uuid, integer)",
|
|
257
262
|
"issue_self_user_resource_grant(uuid, uuid, uuid, text, text, text, uuid, integer, boolean)",
|
|
258
|
-
"issue_self_local_connection_use_grant(uuid, uuid, uuid, text, boolean)",
|
|
259
263
|
"revoke_self_user_resource_grant(uuid, uuid, uuid)",
|
|
260
264
|
"authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid)",
|
|
261
265
|
] as const;
|
|
@@ -263,9 +267,7 @@ const CONNECTION_CONVERGENCE_AUDIT_CAPABILITY_ROUTINE =
|
|
|
263
267
|
"connection_authority_convergence_audit_capability_active(uuid)";
|
|
264
268
|
const CONNECTION_AUTHORITY_ROUTINES = [
|
|
265
269
|
CONNECTION_CONVERGENCE_AUDIT_CAPABILITY_ROUTINE,
|
|
266
|
-
"resolve_personal_connection_authority_selection(uuid, uuid, text, uuid, jsonb)",
|
|
267
270
|
"resolve_accepted_connection_use(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, uuid, text, text, text, text)",
|
|
268
|
-
"resolve_connection_use_authority(uuid, uuid, uuid, jsonb)",
|
|
269
271
|
"inspect_organization_connection_authority_convergence(uuid, integer, uuid)",
|
|
270
272
|
] as const;
|
|
271
273
|
const PERSONAL_GITHUB_REPOSITORY_AUTHORITY_ROUTINES = [
|
|
@@ -280,7 +282,6 @@ const PERSONAL_GITHUB_REPOSITORY_AUTHORITY_TABLES = [
|
|
|
280
282
|
const SCHEDULED_PERSONAL_RESOURCE_ROUTINES = [
|
|
281
283
|
"freeze_scheduled_task_personal_resources(uuid, uuid, uuid, bigint)",
|
|
282
284
|
"clone_scheduled_task_personal_resource_authority(uuid, uuid, uuid, bigint, bigint)",
|
|
283
|
-
"refresh_scheduled_task_personal_resources_clone_connections(uuid, uuid, uuid, bigint, bigint)",
|
|
284
285
|
"create_scheduled_agent_run_with_admission(uuid, uuid, uuid, uuid, bigint, text, text, text, timestamp with time zone, timestamp with time zone, jsonb)",
|
|
285
286
|
"materialize_scheduled_task_reusable_session_from_run(uuid, uuid, uuid, uuid, uuid, bigint, text)",
|
|
286
287
|
"scheduled_task_run_personal_resource_authority(uuid, uuid, uuid)",
|
|
@@ -357,6 +358,11 @@ const SCOPED_COMPUTE_AUTHORITY_ROUTINES = [
|
|
|
357
358
|
"detach_scoped_machine_dependent_sessions(uuid, uuid, uuid)",
|
|
358
359
|
] as const;
|
|
359
360
|
const CANONICAL_HUMAN_IDENTITY_ROUTINES = [
|
|
361
|
+
"mutate_managed_sign_in_method(text, text, jsonb)",
|
|
362
|
+
"assert_managed_sign_in_recovery(text, text, uuid, jsonb)",
|
|
363
|
+
"replay_managed_sign_in_method(text, text, jsonb)",
|
|
364
|
+
"claim_managed_sign_in_notification(uuid, text, text, integer)",
|
|
365
|
+
"settle_managed_sign_in_notification(uuid, uuid, text)",
|
|
360
366
|
"ensure_canonical_human_identity(text, text)",
|
|
361
367
|
"validate_canonical_human_session(text, text, boolean)",
|
|
362
368
|
"get_canonical_human_identity_projection(text)",
|
|
@@ -750,6 +756,7 @@ export const FORCE_RLS_TABLES = [
|
|
|
750
756
|
"codex_reset_redemption_attempts",
|
|
751
757
|
"codex_rotation_settings",
|
|
752
758
|
"codex_subscription_credentials",
|
|
759
|
+
"codex_turn_source_bindings",
|
|
753
760
|
"company_brain_context_selection_receipts",
|
|
754
761
|
"company_brain_preference_proposal_receipts",
|
|
755
762
|
"company_brain_turn_context_snapshots",
|
|
@@ -878,6 +885,7 @@ export const FORCE_RLS_TABLES = [
|
|
|
878
885
|
"managed_auth_login_transactions",
|
|
879
886
|
"managed_auth_session_set_operations",
|
|
880
887
|
"managed_auth_session_sets",
|
|
888
|
+
"managed_sign_in_method_operations",
|
|
881
889
|
"mcp_operations",
|
|
882
890
|
"memory_slack_publication_configurations",
|
|
883
891
|
"memory_slack_publication_receipts",
|
|
@@ -888,6 +896,8 @@ export const FORCE_RLS_TABLES = [
|
|
|
888
896
|
"organization_codex_rotation_settings",
|
|
889
897
|
"organization_company_profile_agent_policies",
|
|
890
898
|
"organization_company_profile_agent_policy_events",
|
|
899
|
+
"organization_integration_policies",
|
|
900
|
+
"organization_integration_policy_operations",
|
|
891
901
|
"organization_invitation_binding_events",
|
|
892
902
|
"organization_membership_invitations",
|
|
893
903
|
"organization_membership_lifecycle_events",
|
|
@@ -922,8 +932,6 @@ export const FORCE_RLS_TABLES = [
|
|
|
922
932
|
"organization_user_setup_intents",
|
|
923
933
|
"organization_workspace_lifecycle_events",
|
|
924
934
|
"organization_workspace_operation_receipts",
|
|
925
|
-
"pack_installation_components",
|
|
926
|
-
"pack_installations",
|
|
927
935
|
"personal_document_once_consumption_receipts",
|
|
928
936
|
"personal_github_repository_selection_heads",
|
|
929
937
|
"personal_github_repository_selection_operations",
|
|
@@ -1073,7 +1081,6 @@ export const FORCE_RLS_TABLES = [
|
|
|
1073
1081
|
"workspace_learning_policy_revisions",
|
|
1074
1082
|
"workspace_learning_policy_snapshots",
|
|
1075
1083
|
"workspace_model_policies",
|
|
1076
|
-
"workspace_packs",
|
|
1077
1084
|
"workspace_screenshot_quotas",
|
|
1078
1085
|
"workspace_session_activity_revisions",
|
|
1079
1086
|
"workspace_variable_set_variables",
|
|
@@ -1201,8 +1208,6 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
1201
1208
|
"organization_model_provider_connection_operations",
|
|
1202
1209
|
"organization_model_provider_connections",
|
|
1203
1210
|
"organization_model_provider_custom_models",
|
|
1204
|
-
"pack_installation_components",
|
|
1205
|
-
"pack_installations",
|
|
1206
1211
|
"pr_review_app_registrations",
|
|
1207
1212
|
"pr_review_managed_github_routes",
|
|
1208
1213
|
"pr_review_repository_bindings",
|
|
@@ -1276,7 +1281,6 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
1276
1281
|
"workspace_instruction_policy_heads",
|
|
1277
1282
|
"workspace_memberships",
|
|
1278
1283
|
"workspace_model_policies",
|
|
1279
|
-
"workspace_packs",
|
|
1280
1284
|
"workspace_screenshot_quotas",
|
|
1281
1285
|
"workspace_video_generation_policies",
|
|
1282
1286
|
"workspace_video_generation_quotas",
|
|
@@ -1290,6 +1294,7 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
1290
1294
|
|
|
1291
1295
|
/** Configuration and lifecycle-owned audit rows are read-only at runtime. */
|
|
1292
1296
|
export const RUNTIME_READ_ONLY_TABLES = [
|
|
1297
|
+
"codex_turn_source_bindings",
|
|
1293
1298
|
"company_profile_activation_events",
|
|
1294
1299
|
"company_profile_heads",
|
|
1295
1300
|
"company_profile_snapshots",
|
|
@@ -1300,6 +1305,8 @@ export const RUNTIME_READ_ONLY_TABLES = [
|
|
|
1300
1305
|
"knowledge_memory_lifecycle_events",
|
|
1301
1306
|
"knowledge_memory_relationships",
|
|
1302
1307
|
"nested_agent_depth_configuration",
|
|
1308
|
+
"organization_integration_policies",
|
|
1309
|
+
"organization_integration_policy_operations",
|
|
1303
1310
|
"preference_registry_events",
|
|
1304
1311
|
"preference_registry_snapshots",
|
|
1305
1312
|
"session_tenancy_activations",
|
|
@@ -1467,6 +1474,7 @@ export const PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
1467
1474
|
"managed_auth_login_transactions",
|
|
1468
1475
|
"managed_auth_session_set_operations",
|
|
1469
1476
|
"managed_auth_session_sets",
|
|
1477
|
+
"managed_sign_in_method_operations",
|
|
1470
1478
|
"mcp_operations",
|
|
1471
1479
|
"organization_company_profile_agent_policies",
|
|
1472
1480
|
"organization_company_profile_agent_policy_events",
|
|
@@ -1680,6 +1688,27 @@ export class RuntimeDatabasePostureError extends Error {
|
|
|
1680
1688
|
}
|
|
1681
1689
|
}
|
|
1682
1690
|
|
|
1691
|
+
/** Posture/configuration mismatches cannot heal through connection backoff. */
|
|
1692
|
+
export function isRetryableRuntimeDatabaseStartupError(error: unknown): boolean {
|
|
1693
|
+
const seen = new Set<unknown>();
|
|
1694
|
+
let current = error;
|
|
1695
|
+
while (current instanceof Error && !seen.has(current)) {
|
|
1696
|
+
seen.add(current);
|
|
1697
|
+
if (current instanceof RuntimeDatabasePostureError) return false;
|
|
1698
|
+
const code = (current as Error & { code?: unknown }).code;
|
|
1699
|
+
// PostgreSQL authentication, missing database, permission, and schema errors.
|
|
1700
|
+
// Network failures and server-starting states retain the existing retry path.
|
|
1701
|
+
if (
|
|
1702
|
+
typeof code === "string" &&
|
|
1703
|
+
["28P01", "28000", "3D000", "42501", "42P01", "42703"].includes(code)
|
|
1704
|
+
) {
|
|
1705
|
+
return false;
|
|
1706
|
+
}
|
|
1707
|
+
current = current.cause;
|
|
1708
|
+
}
|
|
1709
|
+
return true;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1683
1712
|
type IdentityRow = {
|
|
1684
1713
|
current_user: string;
|
|
1685
1714
|
session_user: string;
|
|
@@ -1942,9 +1971,17 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1942
1971
|
c.relforcerowsecurity as rls_forced,
|
|
1943
1972
|
row_security_active(c.oid) as rls_active,
|
|
1944
1973
|
(select count(*)::int from pg_policy policy where policy.polrelid = c.oid) as policy_count,
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
has_table_privilege(current_user, c.oid, '
|
|
1974
|
+
-- Column-only grants on the inventory stamp are also unsafe; in
|
|
1975
|
+
-- particular INSERT can mint authority without a table grant.
|
|
1976
|
+
(has_table_privilege(current_user, c.oid, 'SELECT') or
|
|
1977
|
+
(c.relname = 'modal_inventory_read_capabilities' and
|
|
1978
|
+
has_any_column_privilege(current_user, c.oid, 'SELECT'))) as can_select,
|
|
1979
|
+
(has_table_privilege(current_user, c.oid, 'INSERT') or
|
|
1980
|
+
(c.relname = 'modal_inventory_read_capabilities' and
|
|
1981
|
+
has_any_column_privilege(current_user, c.oid, 'INSERT'))) as can_insert,
|
|
1982
|
+
(has_table_privilege(current_user, c.oid, 'UPDATE') or
|
|
1983
|
+
(c.relname = 'modal_inventory_read_capabilities' and
|
|
1984
|
+
has_any_column_privilege(current_user, c.oid, 'UPDATE'))) as can_update,
|
|
1948
1985
|
has_table_privilege(current_user, c.oid, 'DELETE') as can_delete
|
|
1949
1986
|
from pg_class c
|
|
1950
1987
|
join pg_namespace n on n.oid = c.relnamespace
|
|
@@ -1959,6 +1996,10 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1959
1996
|
${SCOPED_COMPUTE_CAPABILITY_TABLE},
|
|
1960
1997
|
${CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE},
|
|
1961
1998
|
${SANDBOX_FILE_PUBLICATIONS_TABLE},
|
|
1999
|
+
'organization_usage_read_capabilities',
|
|
2000
|
+
'session_file_attachments',
|
|
2001
|
+
'session_file_read_capabilities',
|
|
2002
|
+
'modal_inventory_read_capabilities',
|
|
1962
2003
|
${AUTOMATIC_SESSION_TITLE_FANOUT_OUTBOX_TABLE}
|
|
1963
2004
|
)
|
|
1964
2005
|
`),
|
|
@@ -2166,6 +2207,35 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
2166
2207
|
}
|
|
2167
2208
|
|
|
2168
2209
|
const tableByName = new Map(posture.tables.map((table) => [table.name, table]));
|
|
2210
|
+
if (tableByName.has("organization_integration_policies")) {
|
|
2211
|
+
for (const name of [
|
|
2212
|
+
"update_organization_integration_policy(uuid, text, jsonb)",
|
|
2213
|
+
"assert_organization_integration_policy_administrator(uuid, text)",
|
|
2214
|
+
]) {
|
|
2215
|
+
const routines = posture.privateRoutines.filter((routine) => routine.name === name);
|
|
2216
|
+
const quotedSchema = `"${targetSchema.replaceAll('"', '""')}"`;
|
|
2217
|
+
const searchPaths = new Set([
|
|
2218
|
+
`search_path=pg_catalog, ${quotedSchema}, pg_temp`,
|
|
2219
|
+
`search_path=pg_catalog, ${targetSchema}, pg_temp`,
|
|
2220
|
+
]);
|
|
2221
|
+
const routine = routines[0];
|
|
2222
|
+
if (
|
|
2223
|
+
routines.length !== 1 ||
|
|
2224
|
+
!routine?.execute ||
|
|
2225
|
+
routine.publicExecute ||
|
|
2226
|
+
!routine.securityDefiner ||
|
|
2227
|
+
!routine.configuration?.some((configuration) => searchPaths.has(configuration)) ||
|
|
2228
|
+
[
|
|
2229
|
+
"organization_integration_policies",
|
|
2230
|
+
"organization_integration_policy_operations",
|
|
2231
|
+
"organization_memberships",
|
|
2232
|
+
"api_keys",
|
|
2233
|
+
].some((table) => tableByName.get(table)?.owner !== routine.owner)
|
|
2234
|
+
) {
|
|
2235
|
+
violations.push("organization integration policy mutation capability is missing or unsafe");
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2169
2239
|
const actualRlsTables = new Set(
|
|
2170
2240
|
posture.tables.filter((table) => table.rlsEnabled).map((table) => table.name),
|
|
2171
2241
|
);
|
|
@@ -3562,11 +3632,145 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
3562
3632
|
}
|
|
3563
3633
|
}
|
|
3564
3634
|
|
|
3635
|
+
for (const name of ["session_file_attachments", "session_file_read_capabilities"]) {
|
|
3636
|
+
const table = posture.privateTables.find((candidate) => candidate.name === name);
|
|
3637
|
+
if (!table) {
|
|
3638
|
+
if (!options.protectedTables)
|
|
3639
|
+
violations.push(`session attachment relation ${name} is missing`);
|
|
3640
|
+
continue;
|
|
3641
|
+
}
|
|
3642
|
+
if (
|
|
3643
|
+
table.owner === expectedRole ||
|
|
3644
|
+
table.owner !== tableByName.get("files")?.owner ||
|
|
3645
|
+
table.select ||
|
|
3646
|
+
table.insert ||
|
|
3647
|
+
table.update ||
|
|
3648
|
+
table.delete
|
|
3649
|
+
)
|
|
3650
|
+
violations.push(`session attachment relation ${name} has unsafe authority`);
|
|
3651
|
+
if (
|
|
3652
|
+
name === "session_file_attachments" &&
|
|
3653
|
+
(!table.rlsEnabled || !table.rlsForced || !table.rlsActive || (table.policyCount ?? 0) < 1)
|
|
3654
|
+
)
|
|
3655
|
+
violations.push("session attachment grants lack FORCE-RLS isolation");
|
|
3656
|
+
const routines =
|
|
3657
|
+
name === "session_file_attachments"
|
|
3658
|
+
? [
|
|
3659
|
+
"accept_session_file_attachments(uuid, uuid, uuid, uuid, text, uuid[])",
|
|
3660
|
+
"read_session_file_attachments(uuid, uuid, uuid, integer, uuid[], jsonb)",
|
|
3661
|
+
]
|
|
3662
|
+
: ["session_file_read_allowed(uuid, uuid, uuid)"];
|
|
3663
|
+
for (const signature of routines) {
|
|
3664
|
+
const routine = posture.privateRoutines.find((candidate) => candidate.name === signature);
|
|
3665
|
+
const quotedSchema = `"${targetSchema.replaceAll('"', '""')}"`;
|
|
3666
|
+
const paths =
|
|
3667
|
+
name === "session_file_read_capabilities"
|
|
3668
|
+
? ["search_path=pg_catalog, pg_temp"]
|
|
3669
|
+
: [
|
|
3670
|
+
`search_path=pg_catalog, ${quotedSchema}, pg_temp`,
|
|
3671
|
+
`search_path=pg_catalog, ${targetSchema}, pg_temp`,
|
|
3672
|
+
];
|
|
3673
|
+
if (
|
|
3674
|
+
!routine ||
|
|
3675
|
+
!routine.execute ||
|
|
3676
|
+
routine.publicExecute ||
|
|
3677
|
+
!routine.securityDefiner ||
|
|
3678
|
+
routine.owner !== table.owner ||
|
|
3679
|
+
!routine.configuration?.some((value) => paths.includes(value))
|
|
3680
|
+
)
|
|
3681
|
+
violations.push(`session attachment capability ${signature} is missing or unsafe`);
|
|
3682
|
+
}
|
|
3683
|
+
}
|
|
3684
|
+
|
|
3685
|
+
const organizationUsageCapability = posture.privateTables.find(
|
|
3686
|
+
(table) => table.name === "organization_usage_read_capabilities",
|
|
3687
|
+
);
|
|
3688
|
+
const modalInventoryCapability = posture.privateTables.find(
|
|
3689
|
+
(table) => table.name === "modal_inventory_read_capabilities",
|
|
3690
|
+
);
|
|
3691
|
+
if (modalInventoryCapability) {
|
|
3692
|
+
const capability = modalInventoryCapability;
|
|
3693
|
+
const inventory = posture.privateRoutines.find(
|
|
3694
|
+
(routine) => routine.name === "list_live_modal_sandbox_leases()",
|
|
3695
|
+
);
|
|
3696
|
+
if (
|
|
3697
|
+
capability.owner === expectedRole ||
|
|
3698
|
+
capability.owner !== tableByName.get("sandbox_leases")?.owner ||
|
|
3699
|
+
capability.select ||
|
|
3700
|
+
capability.insert ||
|
|
3701
|
+
capability.update ||
|
|
3702
|
+
capability.delete ||
|
|
3703
|
+
!inventory?.execute ||
|
|
3704
|
+
!inventory.securityDefiner ||
|
|
3705
|
+
inventory.publicExecute ||
|
|
3706
|
+
inventory.owner !== capability.owner ||
|
|
3707
|
+
!inventory.configuration?.includes("search_path=pg_catalog")
|
|
3708
|
+
) {
|
|
3709
|
+
violations.push("Modal inventory capability has unsafe owner, ACL or runtime privileges");
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
if (organizationUsageCapability) {
|
|
3713
|
+
const capability = organizationUsageCapability;
|
|
3714
|
+
if (
|
|
3715
|
+
capability.owner === expectedRole ||
|
|
3716
|
+
capability.owner !== tableByName.get("usage_events")?.owner ||
|
|
3717
|
+
capability.select ||
|
|
3718
|
+
capability.insert ||
|
|
3719
|
+
capability.update ||
|
|
3720
|
+
capability.delete
|
|
3721
|
+
) {
|
|
3722
|
+
violations.push(
|
|
3723
|
+
"organization usage capability has unsafe owner or direct runtime privileges",
|
|
3724
|
+
);
|
|
3725
|
+
}
|
|
3726
|
+
const aggregateRoutine = posture.privateRoutines.find(
|
|
3727
|
+
(routine) =>
|
|
3728
|
+
routine.name ===
|
|
3729
|
+
"organization_usage_summary(uuid, timestamp with time zone, timestamp with time zone, text, uuid, boolean)",
|
|
3730
|
+
);
|
|
3731
|
+
if (
|
|
3732
|
+
!aggregateRoutine ||
|
|
3733
|
+
!aggregateRoutine.securityDefiner ||
|
|
3734
|
+
!aggregateRoutine.execute ||
|
|
3735
|
+
aggregateRoutine.publicExecute ||
|
|
3736
|
+
aggregateRoutine.owner !== capability.owner
|
|
3737
|
+
) {
|
|
3738
|
+
violations.push("organization usage aggregate capability is missing or unsafe");
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3565
3742
|
for (const routine of posture.privateRoutines) {
|
|
3566
3743
|
if (routine.owner === expectedRole) {
|
|
3567
3744
|
violations.push(`runtime role owns private routine ${routine.name}`);
|
|
3568
3745
|
}
|
|
3569
3746
|
const ownerInternalRoutine = OWNER_INTERNAL_PRIVATE_ROUTINES.has(routine.name);
|
|
3747
|
+
if (
|
|
3748
|
+
["validate_mcp_account_bindings(jsonb, jsonb)", "fence_mcp_account_bindings()"].includes(
|
|
3749
|
+
routine.name,
|
|
3750
|
+
)
|
|
3751
|
+
) {
|
|
3752
|
+
if (routine.execute || routine.publicExecute) {
|
|
3753
|
+
violations.push(
|
|
3754
|
+
`runtime or PUBLIC has forbidden EXECUTE on MCP account binding internal routine ${routine.name}`,
|
|
3755
|
+
);
|
|
3756
|
+
}
|
|
3757
|
+
if (routine.owner !== tableByName.get("session_turns")?.owner) {
|
|
3758
|
+
violations.push(
|
|
3759
|
+
`MCP account binding internal routine ${routine.name} owner does not match turn owner`,
|
|
3760
|
+
);
|
|
3761
|
+
}
|
|
3762
|
+
if (routine.securityDefiner !== (routine.name === "fence_mcp_account_bindings()")) {
|
|
3763
|
+
violations.push(
|
|
3764
|
+
`MCP account binding internal routine ${routine.name} has unsafe execution mode`,
|
|
3765
|
+
);
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3768
|
+
if (
|
|
3769
|
+
routine.name === "read_sender_connection(uuid, uuid, uuid, text)" &&
|
|
3770
|
+
(routine.execute || routine.publicExecute)
|
|
3771
|
+
) {
|
|
3772
|
+
violations.push("runtime or PUBLIC can call the internal sender connection reader");
|
|
3773
|
+
}
|
|
3570
3774
|
if (
|
|
3571
3775
|
[
|
|
3572
3776
|
"guard_mcp_operation_immutable()",
|