@opengeni/db 1.0.1 → 3.1.0-canary.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/attached-browser-devices.d.ts +7 -0
- package/dist/automations.d.ts +154 -0
- package/dist/canonical-human-identities.js +3 -3
- package/dist/capability-integrations.d.ts +13 -0
- package/dist/child-lifecycle-notices.d.ts +68 -0
- package/dist/{chunk-LTG3S6ZY.js → chunk-EULAN2NP.js} +2 -2
- package/dist/{chunk-CUPM3FGB.js → chunk-NJVZPWXY.js} +3 -3
- package/dist/{chunk-4SR4HKKA.js → chunk-NMUBV7Z5.js} +19 -11
- package/dist/chunk-NMUBV7Z5.js.map +1 -0
- package/dist/chunk-OF5OBB76.js +4457 -0
- package/dist/chunk-OF5OBB76.js.map +1 -0
- package/dist/{chunk-6ZYKCRFO.js → chunk-PR2WMLOQ.js} +7580 -4417
- package/dist/chunk-PR2WMLOQ.js.map +1 -0
- package/dist/{chunk-ZWREYEWA.js → chunk-SCPUJS53.js} +41 -4
- package/dist/chunk-SCPUJS53.js.map +1 -0
- package/dist/{chunk-SK7YYHBI.js → chunk-SIBYBA2D.js} +46 -1
- package/dist/chunk-SIBYBA2D.js.map +1 -0
- package/dist/chunk-TIKF3KTI.js +383 -0
- package/dist/chunk-TIKF3KTI.js.map +1 -0
- package/dist/chunk-ZZ5LJEFX.js +516 -0
- package/dist/chunk-ZZ5LJEFX.js.map +1 -0
- package/dist/codemode-operations.d.ts +1 -6
- package/dist/company-brain-context-selection-schema.d.ts +705 -0
- package/dist/company-brain-context-selection.d.ts +94 -0
- package/dist/company-brain-governed-writes.d.ts +24 -0
- package/dist/company-brain.d.ts +55 -0
- package/dist/company-profile-agent-admin.d.ts +15 -0
- package/dist/company-profile-schema.d.ts +619 -2
- package/dist/company-profile.d.ts +9 -4
- package/dist/connection-authority.d.ts +95 -0
- package/dist/connection-scopes.d.ts +8 -0
- package/dist/connection-tenancy-backfill.d.ts +41 -0
- package/dist/connection-token-resolver.d.ts +30 -1
- package/dist/database.d.ts +19 -0
- package/dist/editable-artifact-durable-export.js +2 -2
- package/dist/editable-artifacts.d.ts +2 -2
- package/dist/editable-artifacts.js +3 -3
- package/dist/governed-learning-activation-schema.d.ts +984 -0
- package/dist/governed-learning-activation.d.ts +98 -0
- package/dist/governed-learning-evaluator-schema.d.ts +633 -0
- package/dist/governed-learning-evaluator.d.ts +28 -0
- package/dist/index.d.ts +1595 -81
- package/dist/index.js +21571 -8126
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +18 -0
- package/dist/integration-bindings.d.ts +1 -0
- package/dist/integration-facets.d.ts +30 -0
- package/dist/interaction-placement-loss.d.ts +22 -0
- package/dist/managed-human-provisioning.d.ts +25 -0
- package/dist/memory-domain.d.ts +3 -3
- package/dist/migrate.d.ts +11 -1
- package/dist/migrate.js +1 -1
- package/dist/new-session-drafts.d.ts +43 -5
- package/dist/organization-membership-backfill.d.ts +174 -0
- package/dist/organization-membership-lifecycle.d.ts +162 -0
- package/dist/pr-review.d.ts +107 -0
- package/dist/preference-registry-schema.d.ts +2 -0
- package/dist/preference-registry.d.ts +2 -0
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +22 -8
- package/dist/schema.d.ts +24914 -13703
- package/dist/schema.js +99 -1
- package/dist/scoped-knowledge-schema.d.ts +52 -1
- package/dist/session-background-commands.d.ts +125 -0
- package/dist/session-background-commands.js +34 -0
- package/dist/session-background-commands.js.map +1 -0
- package/dist/session-control.d.ts +156 -3
- package/dist/session-goal-pacing.d.ts +68 -0
- package/dist/session-queue-commands.d.ts +41 -4
- package/dist/session-realtime-ledger.d.ts +2 -0
- package/dist/session-tenancy.d.ts +71 -1
- package/dist/session-tenancy.js +25 -3
- package/dist/session-tool-call-settlement.d.ts +9 -4
- package/dist/slack-routing-personal-workspace.d.ts +23 -0
- package/dist/slack-routing.d.ts +153 -0
- package/dist/slack-task-policy-schema.d.ts +34 -0
- package/dist/slack-task-policy.d.ts +8 -0
- package/dist/slack-user-link-access.d.ts +1 -0
- package/dist/task-notes-schema.d.ts +594 -0
- package/dist/task-notes.d.ts +39 -0
- package/dist/turn-initiator.d.ts +2 -0
- package/dist/user-resource-authority.d.ts +109 -0
- package/dist/video-generation.js +3 -3
- package/dist/workspace-authority.d.ts +81 -0
- package/dist/workspace-instruction-policies-schema.d.ts +279 -0
- package/dist/workspace-instruction-policies.d.ts +62 -0
- package/dist/workspace-learning-policy.d.ts +1 -0
- package/dist/workspace-membership-permissions.d.ts +2 -0
- package/drizzle/0240_enrollment_connection_authority.sql +39 -0
- package/drizzle/0241_atomic_personal_resource_delegation.sql +1000 -0
- package/drizzle/0241_enrollment_agent_runtime.sql +70 -0
- package/drizzle/0244_slack_app_home_refresh_queue.sql +120 -0
- package/drizzle/0245_model_context_contribution_facts.sql +88 -0
- package/drizzle/0246_integration_personal_instance_authority.sql +70 -0
- package/drizzle/0247_terraform_stacks_provenance_repair.sql +428 -0
- package/drizzle/0248_terraform_stacks_component_resolution_fence.sql +83 -0
- package/drizzle/0249_personal_resource_delegation_authority_correction.sql +662 -0
- package/drizzle/0250_direct_retained_process_owner_liveness.sql +199 -0
- package/drizzle/0251_connected_machine_operation_policy.sql +45 -0
- package/drizzle/0252_scheduled_personal_resource_delegation.sql +1867 -0
- package/drizzle/0253_common_user_resource_authority_lifecycle.sql +1555 -0
- package/drizzle/0254_scoped_variable_set_authority.sql +1255 -0
- package/drizzle/0255_company_brain_governed_write_proposals.sql +524 -0
- package/drizzle/0256_connection_authority_delegation.sql +703 -0
- package/drizzle/0257_goal_revision_decisions_and_root_constraints.sql +436 -0
- package/drizzle/0258_three_scope_document_knowledge_authority.sql +1273 -0
- package/drizzle/0259_company_brain_context_selection_receipts.sql +869 -0
- package/drizzle/0260_task_note_knowledge_promotion.sql +820 -0
- package/drizzle/0261_preference_knowledge_proposal_actor_binding.sql +471 -0
- package/drizzle/0262_scoped_connected_machines_and_rigs.sql +1700 -0
- package/drizzle/0263_organization_membership_lifecycle.sql +3284 -0
- package/drizzle/0264_connection_authority_runtime_activation.sql +1084 -0
- package/drizzle/0266_company_brain_context_receipt_inspection.sql +156 -0
- package/drizzle/0268_governed_learning_decision_receipts.sql +825 -0
- package/drizzle/0269_governed_learning_activation_controller.sql +1874 -0
- package/drizzle/0270_governed_learning_history_inspection.sql +170 -0
- package/drizzle/0271_company_brain_retrieval_only_default.sql +524 -0
- package/drizzle/0272_human_confirmed_learning_activation.sql +591 -0
- package/drizzle/0273_scheduled_variable_set_materialization.sql +268 -0
- package/drizzle/0274_human_confirmed_knowledge_review.sql +310 -0
- package/drizzle/0275_scheduled_connection_authority.sql +5527 -0
- package/drizzle/0276_onboarding_proposal_initiating_human_guc.sql +198 -0
- package/drizzle/0277_workspace_writer_authority_attribution.sql +393 -0
- package/drizzle/0278_workspace_membership_removal_fencing.sql +1174 -0
- package/drizzle/0279_workspace_connection_use_lane.sql +343 -0
- package/drizzle/0280_connection_and_variable_set_audit_attribution.sql +773 -0
- package/drizzle/0281_viewer_holder_authority_claims.sql +52 -0
- package/drizzle/0282_variable_set_session_attach_attribution.sql +178 -0
- package/drizzle/0283_editable_spreadsheet_authored_state.sql +82 -0
- package/drizzle/0284_truthful_human_confirmed_review_reason.sql +930 -0
- package/drizzle/0285_organization_tenancy_inventory.sql +329 -0
- package/drizzle/0286_widen_task_note_expiry_ceiling.sql +391 -0
- package/drizzle/0287_open_suffix_pending_tool_calls.sql +18 -0
- package/drizzle/0288_attached_browser_reenrollment.sql +64 -0
- package/drizzle/0289_session_composer_policy_authority.sql +597 -0
- package/drizzle/0290_organization_membership_backfill.sql +268 -0
- package/drizzle/0291_resource_authority_classification_assertion.sql +371 -0
- package/drizzle/0292_truthful_tenancy_inventory_counters.sql +291 -0
- package/drizzle/0293_confirm_time_rule_rebaseline.sql +615 -0
- package/drizzle/0294_preference_activation_authority.sql +237 -0
- package/drizzle/0295_retire_legacy_standing_memory_mode.sql +476 -0
- package/drizzle/0296_force_rls_backfill_noop_repair.sql +215 -0
- package/drizzle/0297_session_ownership_classification_and_backfill.sql +752 -0
- package/drizzle/0298_organization_tenancy_parity.sql +609 -0
- package/drizzle/0299_organization_membership_lock_order.sql +291 -0
- package/drizzle/0300_tenancy_backfill_ledger.sql +459 -0
- package/drizzle/0301_session_snapshot_and_pin_visibility.sql +181 -0
- package/drizzle/0302_personal_workspace_session_ownership.sql +303 -0
- package/drizzle/0303_session_tenancy_product_activation.sql +919 -0
- package/drizzle/0304_personal_workspace_private_session_reads.sql +97 -0
- package/drizzle/0305_personal_resource_grant_management.sql +584 -0
- package/drizzle/0306_atomic_personal_resource_attachments.sql +1374 -0
- package/drizzle/0307_session_attention_state.sql +51 -0
- package/drizzle/0308_session_archives.sql +35 -0
- package/drizzle/0309_channel_project_pins.sql +6 -0
- package/drizzle/0310_channel_project_order.sql +27 -0
- package/drizzle/0311_company_scope_and_private_session_create.sql +656 -0
- package/drizzle/0312_quiescent_session_tree_deletion.sql +39 -0
- package/drizzle/0313_private_child_session_authority.sql +365 -0
- package/drizzle/0314_unregistered_organization_invitations.sql +606 -0
- package/drizzle/0315_personal_github_repository_selection.sql +624 -0
- package/drizzle/0316_human_confirmed_activation_resumed_generation.sql +869 -0
- package/drizzle/0317_session_goal_continuation_hold.sql +64 -0
- package/drizzle/0318_session_turn_startup_milestones.sql +115 -0
- package/drizzle/0319_event_triggered_automations.sql +254 -0
- package/drizzle/0320_pr_review_pack.sql +113 -0
- package/drizzle/0321_slack_bot_environment_display_name.sql +15 -0
- package/drizzle/0322_session_turns_unclaimed_prompt_trigger_index.sql +5 -0
- package/drizzle/0323_organization_private_session_enablement.sql +489 -0
- package/drizzle/0324_human_confirmed_company_profile_agent_admin.sql +856 -0
- package/drizzle/0325_child_lifecycle_notices.sql +44 -0
- package/drizzle/0326_interaction_operation_error_codes.sql +62 -0
- package/drizzle/0327_slack_first_task_hint.sql +29 -0
- package/drizzle/0328_session_background_commands.sql +590 -0
- package/drizzle/0329_slack_orchestration_delivery_events.sql +91 -0
- package/drizzle/0330_api_key_descriptions.sql +20 -0
- package/drizzle/0331_managed_organization_creation.sql +163 -0
- package/drizzle/0332_organization_shared_workspace_control_plane.sql +539 -0
- package/drizzle/0333_session_turn_prompt_routing.sql +45 -0
- package/drizzle/0334_connected_machine_workspace_root.sql +99 -0
- package/drizzle/0335_slack_workspace_routing.sql +460 -0
- package/drizzle/0336_atomic_session_fork_visibility.sql +667 -0
- package/drizzle/0337_slack_routed_action_handles.sql +189 -0
- package/drizzle/0338_atomic_connected_machine_attachments.sql +410 -0
- package/drizzle/0339_document_authority_reclassification.sql +1153 -0
- package/drizzle/0340_tenancy_backfill_activation_evidence.sql +1347 -0
- package/drizzle/0341_slack_routing_probe_organization_fence.sql +109 -0
- package/package.json +10 -6
- package/src/attached-browser-devices.ts +233 -5
- package/src/automations.ts +911 -0
- package/src/browser-sessions.ts +10 -0
- package/src/capability-integrations.ts +175 -1
- package/src/child-lifecycle-notices.ts +241 -0
- package/src/codemode-operations.ts +1 -35
- package/src/company-brain-context-selection-schema.ts +100 -0
- package/src/company-brain-context-selection.ts +359 -0
- package/src/company-brain-governed-writes.ts +1170 -0
- package/src/company-brain.ts +309 -0
- package/src/company-profile-agent-admin.ts +225 -0
- package/src/company-profile-schema.ts +121 -1
- package/src/company-profile.ts +21 -0
- package/src/computer-sessions.ts +10 -1
- package/src/connection-authority.ts +290 -0
- package/src/connection-scopes.ts +20 -0
- package/src/connection-tenancy-backfill.ts +81 -0
- package/src/connection-token-resolver.ts +263 -31
- package/src/database.ts +75 -2
- package/src/editable-artifacts-schema.ts +10 -5
- package/src/editable-artifacts.ts +21 -11
- package/src/governed-learning-activation-schema.ts +121 -0
- package/src/governed-learning-activation.ts +588 -0
- package/src/governed-learning-evaluator-schema.ts +72 -0
- package/src/governed-learning-evaluator.ts +217 -0
- package/src/index.ts +11651 -1548
- package/src/insights.ts +107 -0
- package/src/integration-bindings.ts +88 -6
- package/src/integration-facets.ts +287 -84
- package/src/interaction-placement-loss.ts +234 -0
- package/src/managed-human-provisioning.ts +116 -0
- package/src/memory-domain.ts +27 -32
- package/src/migrate.ts +77 -1
- package/src/new-session-drafts.ts +229 -35
- package/src/organization-membership-backfill.ts +735 -0
- package/src/organization-membership-lifecycle.ts +985 -0
- package/src/pr-review.ts +890 -0
- package/src/preference-registry.ts +31 -1
- package/src/provision-roles.ts +877 -6
- package/src/runtime-posture-cli.ts +2 -0
- package/src/runtime-posture.ts +1291 -76
- package/src/schema.ts +3303 -428
- package/src/scoped-knowledge-schema.ts +16 -8
- package/src/scoped-knowledge.ts +1 -1
- package/src/session-background-commands.ts +759 -0
- package/src/session-control.ts +640 -74
- package/src/session-goal-pacing.ts +126 -0
- package/src/session-queue-commands.ts +437 -84
- package/src/session-realtime-context.ts +3 -3
- package/src/session-realtime-ledger.ts +22 -11
- package/src/session-realtime-mirror.ts +1 -1
- package/src/session-tenancy.ts +403 -49
- package/src/session-tool-call-settlement.ts +38 -29
- package/src/slack-routing-personal-workspace.ts +67 -0
- package/src/slack-routing.ts +469 -0
- package/src/slack-task-policy-schema.ts +5 -0
- package/src/slack-task-policy.ts +18 -0
- package/src/slack-user-link-access.ts +17 -1
- package/src/task-notes-schema.ts +74 -0
- package/src/task-notes.ts +124 -2
- package/src/turn-initiator.ts +8 -0
- package/src/user-resource-authority.ts +377 -0
- package/src/workspace-authority.ts +160 -0
- package/src/workspace-instruction-policies-schema.ts +53 -1
- package/src/workspace-instruction-policies.ts +528 -77
- package/src/workspace-learning-policy.ts +21 -5
- package/src/workspace-membership-permissions.ts +9 -0
- package/dist/chunk-4SR4HKKA.js.map +0 -1
- package/dist/chunk-6ZYKCRFO.js.map +0 -1
- package/dist/chunk-NXAFLCQX.js +0 -2468
- package/dist/chunk-NXAFLCQX.js.map +0 -1
- package/dist/chunk-SK7YYHBI.js.map +0 -1
- package/dist/chunk-WD5ROSLL.js +0 -117
- package/dist/chunk-WD5ROSLL.js.map +0 -1
- package/dist/chunk-ZWREYEWA.js.map +0 -1
- /package/dist/{chunk-LTG3S6ZY.js.map → chunk-EULAN2NP.js.map} +0 -0
- /package/dist/{chunk-CUPM3FGB.js.map → chunk-NJVZPWXY.js.map} +0 -0
package/src/runtime-posture.ts
CHANGED
|
@@ -66,12 +66,205 @@ const KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES = [
|
|
|
66
66
|
] as const;
|
|
67
67
|
const MANAGED_HUMAN_PERSONAL_WORKSPACE_ROUTINE =
|
|
68
68
|
"ensure_managed_human_personal_workspace(uuid, text, uuid)";
|
|
69
|
+
const ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES = [
|
|
70
|
+
"list_self_organization_memberships(text)",
|
|
71
|
+
"list_self_organization_invitations(text)",
|
|
72
|
+
"list_self_organization_invitations(text, uuid, integer)",
|
|
73
|
+
"get_self_organization_invitation(text, uuid)",
|
|
74
|
+
"list_organization_invitations(uuid, text, uuid, integer)",
|
|
75
|
+
"list_organization_members(uuid, text)",
|
|
76
|
+
"get_organization_administration_overview(uuid, text)",
|
|
77
|
+
"create_managed_organization(text, text, text, uuid)",
|
|
78
|
+
"assert_organization_shared_workspace_administrator(uuid, uuid, text)",
|
|
79
|
+
"open_organization_shared_workspace_administration_capability(uuid, uuid, text)",
|
|
80
|
+
"close_organization_shared_workspace_administration_capability(uuid)",
|
|
81
|
+
"create_organization_shared_workspace(uuid, text, text, text, text, uuid)",
|
|
82
|
+
"upsert_organization_shared_workspace_member(uuid, uuid, text, uuid, text, text, jsonb, boolean)",
|
|
83
|
+
"update_organization_name(uuid, text, text, timestamp with time zone, uuid)",
|
|
84
|
+
"create_organization_invitation_v2(jsonb)",
|
|
85
|
+
"bind_pending_organization_invitations_for_verified_email(text, text)",
|
|
86
|
+
"has_pending_organization_invitation_for_subject(text)",
|
|
87
|
+
"accept_organization_invitation_v2(jsonb)",
|
|
88
|
+
"organization_membership_command(jsonb)",
|
|
89
|
+
"prepare_organization_membership_protocol_settlements(jsonb)",
|
|
90
|
+
"assert_active_managed_human_organization_membership(uuid, text)",
|
|
91
|
+
"resolve_workspace_writer_grant_identity(uuid, text)",
|
|
92
|
+
"prepare_workspace_membership_removal_settlements(jsonb)",
|
|
93
|
+
"workspace_membership_removal_command(jsonb)",
|
|
94
|
+
"get_organization_retention_policy(uuid, text)",
|
|
95
|
+
"preview_organization_retention_deletions(uuid, integer)",
|
|
96
|
+
"claim_organization_retention_deletion(uuid, uuid, uuid[])",
|
|
97
|
+
"list_organization_retention_deletion_objects(uuid, uuid, uuid, text, integer)",
|
|
98
|
+
"record_organization_retention_object_deleted(uuid, uuid, uuid, text, text, text, text)",
|
|
99
|
+
"fail_organization_retention_deletion(uuid, uuid, uuid, text)",
|
|
100
|
+
"finalize_organization_retention_deletion(uuid, uuid, uuid, text)",
|
|
101
|
+
"complete_organization_retention_deletion(uuid, uuid, uuid, text)",
|
|
102
|
+
] as const;
|
|
103
|
+
const ORGANIZATION_MEMBERSHIP_LIFECYCLE_AUTHORITY_TABLES = [
|
|
104
|
+
"organization_invitation_binding_events",
|
|
105
|
+
"organization_membership_invitations",
|
|
106
|
+
"organization_membership_lifecycle_events",
|
|
107
|
+
"organization_membership_operation_receipts",
|
|
108
|
+
"organization_memberships",
|
|
109
|
+
"organization_profile_events",
|
|
110
|
+
"organization_shared_workspace_administration_capabilities",
|
|
111
|
+
"organization_user_resource_authorities",
|
|
112
|
+
"organization_user_resource_grants",
|
|
113
|
+
"organization_user_retention_deletion_events",
|
|
114
|
+
"organization_user_retention_deletions",
|
|
115
|
+
"organization_user_retention_object_deletion_receipts",
|
|
116
|
+
"organization_user_retention_object_obligations",
|
|
117
|
+
"organization_user_retention_policies",
|
|
118
|
+
] as const;
|
|
119
|
+
const PRIVATE_SESSION_CREATE_POLICY_ROUTINE = "get_private_session_create_policy(uuid, uuid, text)";
|
|
120
|
+
const ORGANIZATION_PRIVATE_SESSION_SETTINGS_READ_ROUTINE =
|
|
121
|
+
"get_organization_private_session_settings(uuid, text)";
|
|
122
|
+
const ORGANIZATION_PRIVATE_SESSION_SETTINGS_UPDATE_ROUTINE =
|
|
123
|
+
"update_organization_private_session_settings(uuid, text, boolean, bigint, uuid)";
|
|
124
|
+
const ORGANIZATION_PRIVATE_SESSION_ROUTINE_AUTHORITY_TABLES = {
|
|
125
|
+
[PRIVATE_SESSION_CREATE_POLICY_ROUTINE]: [
|
|
126
|
+
"organization_memberships",
|
|
127
|
+
"organization_private_session_settings",
|
|
128
|
+
"session_tenancy_activations",
|
|
129
|
+
"workspace_memberships",
|
|
130
|
+
"workspaces",
|
|
131
|
+
],
|
|
132
|
+
[ORGANIZATION_PRIVATE_SESSION_SETTINGS_READ_ROUTINE]: [
|
|
133
|
+
"managed_accounts",
|
|
134
|
+
"organization_memberships",
|
|
135
|
+
"organization_private_session_settings",
|
|
136
|
+
"session_tenancy_activations",
|
|
137
|
+
],
|
|
138
|
+
[ORGANIZATION_PRIVATE_SESSION_SETTINGS_UPDATE_ROUTINE]: [
|
|
139
|
+
"managed_accounts",
|
|
140
|
+
"organization_memberships",
|
|
141
|
+
"organization_private_session_setting_events",
|
|
142
|
+
"organization_private_session_settings",
|
|
143
|
+
"session_tenancy_activations",
|
|
144
|
+
],
|
|
145
|
+
} as const;
|
|
146
|
+
const ORGANIZATION_PRIVATE_SESSION_ROUTINES = Object.keys(
|
|
147
|
+
ORGANIZATION_PRIVATE_SESSION_ROUTINE_AUTHORITY_TABLES,
|
|
148
|
+
);
|
|
149
|
+
const ORGANIZATION_PRIVATE_SESSIONS_ENABLED_ROUTINE = "organization_private_sessions_enabled(uuid)";
|
|
150
|
+
const PREFERENCE_KNOWLEDGE_PROPOSAL_ROUTINE =
|
|
151
|
+
"preference_registry_create_knowledge_proposal_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, uuid, text, text, text, text, integer, text, jsonb, timestamp with time zone, text)";
|
|
152
|
+
const PREFERENCE_KNOWLEDGE_PROPOSAL_AUTHORITY_TABLES = [
|
|
153
|
+
"company_brain_preference_proposal_receipts",
|
|
154
|
+
"knowledge_change_proposals",
|
|
155
|
+
"knowledge_claim_evidence",
|
|
156
|
+
"knowledge_claim_reviews",
|
|
157
|
+
"knowledge_claims",
|
|
158
|
+
"preference_registry_events",
|
|
159
|
+
"preference_registry_preferences",
|
|
160
|
+
"preference_registry_revisions",
|
|
161
|
+
"session_attempt_interruptions",
|
|
162
|
+
"session_turn_attempts",
|
|
163
|
+
"session_turns",
|
|
164
|
+
"sessions",
|
|
165
|
+
"workspaces",
|
|
166
|
+
] as const;
|
|
69
167
|
const MANAGED_HUMAN_PERSONAL_WORKSPACE_AUTHORITY_TABLES = [
|
|
70
168
|
"organization_memberships",
|
|
71
169
|
"organization_user_retention_policies",
|
|
72
170
|
"organization_user_resource_authorities",
|
|
73
171
|
"organization_user_resource_grants",
|
|
74
172
|
] as const;
|
|
173
|
+
const PERSONAL_RESOURCE_ATTEMPT_RESOLVER_ROUTINE =
|
|
174
|
+
"resolve_session_attempt_personal_resources(uuid, uuid, uuid)";
|
|
175
|
+
const USER_RESOURCE_LIFECYCLE_ROUTINES = [
|
|
176
|
+
"accept_turn_personal_resource_attachment(uuid, uuid, uuid, uuid, text, integer, boolean, integer)",
|
|
177
|
+
"list_self_user_resource_authorities(uuid, uuid, text, uuid, integer)",
|
|
178
|
+
"issue_self_user_resource_grant(uuid, uuid, uuid, text, text, text, uuid, integer, boolean)",
|
|
179
|
+
"revoke_self_user_resource_grant(uuid, uuid, uuid)",
|
|
180
|
+
"authorize_session_attempt_personal_resource_reads(uuid, uuid, uuid)",
|
|
181
|
+
] as const;
|
|
182
|
+
const CONNECTION_AUTHORITY_ROUTINES = [
|
|
183
|
+
"resolve_personal_connection_authority_selection(uuid, uuid, text, uuid, jsonb)",
|
|
184
|
+
"resolve_accepted_connection_use(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, uuid, text, text, text, text)",
|
|
185
|
+
"resolve_connection_use_authority(uuid, uuid, uuid, jsonb)",
|
|
186
|
+
] as const;
|
|
187
|
+
const PERSONAL_GITHUB_REPOSITORY_AUTHORITY_ROUTINES = [
|
|
188
|
+
"get_self_personal_github_repository_selection(uuid, uuid, text, uuid)",
|
|
189
|
+
"mutate_self_personal_github_repository_selection(uuid, uuid, text, uuid, bigint, bigint, text, jsonb, boolean)",
|
|
190
|
+
] as const;
|
|
191
|
+
const PERSONAL_GITHUB_REPOSITORY_AUTHORITY_TABLES = [
|
|
192
|
+
"personal_github_repository_selection_heads",
|
|
193
|
+
"personal_github_repository_selection_operations",
|
|
194
|
+
"personal_github_repository_selections",
|
|
195
|
+
] as const;
|
|
196
|
+
const SCHEDULED_PERSONAL_RESOURCE_ROUTINES = [
|
|
197
|
+
"freeze_scheduled_task_personal_resources(uuid, uuid, uuid, bigint)",
|
|
198
|
+
"clone_scheduled_task_personal_resource_authority(uuid, uuid, uuid, bigint, bigint)",
|
|
199
|
+
"refresh_scheduled_task_personal_resources_clone_connections(uuid, uuid, uuid, bigint, bigint)",
|
|
200
|
+
"create_scheduled_agent_run_with_admission(uuid, uuid, uuid, uuid, bigint, text, text, text, timestamp with time zone, timestamp with time zone, jsonb)",
|
|
201
|
+
"materialize_scheduled_task_reusable_session_from_run(uuid, uuid, uuid, uuid, uuid, bigint, text)",
|
|
202
|
+
"scheduled_task_run_personal_resource_authority(uuid, uuid, uuid)",
|
|
203
|
+
"scheduled_task_run_connection_authority_subject(uuid, uuid, uuid)",
|
|
204
|
+
"scheduled_task_personal_resource_authority_subject(uuid, uuid, uuid, bigint)",
|
|
205
|
+
"record_scheduled_task_revision_authority(uuid, uuid, uuid, bigint)",
|
|
206
|
+
"clone_scheduled_task_revision_authority(uuid, uuid, uuid, bigint, bigint)",
|
|
207
|
+
"scheduled_task_revision_authority_subject(uuid, uuid, uuid, bigint)",
|
|
208
|
+
"scheduled_task_revision_authority_snapshot(uuid, uuid, uuid, bigint)",
|
|
209
|
+
"validate_scheduled_agent_run_live_authority(uuid, uuid, uuid)",
|
|
210
|
+
"scheduled_scoped_rig_version_metadata(uuid, uuid, text, uuid, uuid)",
|
|
211
|
+
"scheduled_variable_set_expected_generation_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid)",
|
|
212
|
+
"bind_scheduled_task_run_session(uuid, uuid, uuid, uuid)",
|
|
213
|
+
"transition_scheduled_agent_run(uuid, uuid, uuid, uuid, uuid, text, text)",
|
|
214
|
+
] as const;
|
|
215
|
+
const PERSONAL_RESOURCE_CAPABILITY_PREDICATE_ROUTINE =
|
|
216
|
+
"personal_resource_delegation_capability_active(text)";
|
|
217
|
+
const PERSONAL_RESOURCE_CAPABILITY_TABLE = "personal_resource_delegation_capabilities";
|
|
218
|
+
const SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_PREDICATE_ROUTINE =
|
|
219
|
+
"scheduled_personal_resource_capability_active(text)";
|
|
220
|
+
const SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_TABLE = "scheduled_personal_resource_capabilities";
|
|
221
|
+
const VARIABLE_SET_CAPABILITY_PREDICATE_ROUTINE = "variable_set_authority_capability_active(text)";
|
|
222
|
+
const VARIABLE_SET_CAPABILITY_TABLE = "variable_set_authority_capabilities";
|
|
223
|
+
const PERSONAL_DOCUMENT_CAPABILITY_PREDICATE_ROUTINE =
|
|
224
|
+
"personal_document_authority_capability_active(text)";
|
|
225
|
+
const PERSONAL_DOCUMENT_CAPABILITY_TABLE = "personal_document_authority_capabilities";
|
|
226
|
+
const PERSONAL_DOCUMENT_AUTHORITY_ROUTINES = [
|
|
227
|
+
"create_personal_document_authority(uuid, uuid, uuid)",
|
|
228
|
+
"resolve_document_original_file(uuid, uuid, text, uuid)",
|
|
229
|
+
"resolve_session_attempt_personal_document_reads(uuid, uuid, uuid, uuid)",
|
|
230
|
+
] as const;
|
|
231
|
+
const DOCUMENT_MIGRATION_CAPABILITY_PREDICATE_ROUTINE =
|
|
232
|
+
"document_migration_capability_active(text)";
|
|
233
|
+
const DOCUMENT_MIGRATION_CAPABILITY_TABLE = "document_migration_capabilities";
|
|
234
|
+
const DOCUMENT_MIGRATION_AUTHORITY_ROUTINES = [
|
|
235
|
+
"list_document_authority_reclassifications(uuid, uuid, text, uuid, integer, timestamp with time zone, uuid)",
|
|
236
|
+
"reclassify_document_authority(jsonb)",
|
|
237
|
+
"run_document_default_collection_backfill(jsonb)",
|
|
238
|
+
] as const;
|
|
239
|
+
const VARIABLE_SET_AUTHORITY_ROUTINES = [
|
|
240
|
+
"create_scoped_variable_set(uuid, uuid, text, text, text, jsonb, boolean)",
|
|
241
|
+
"list_scoped_variable_sets(uuid, uuid, uuid, text, text)",
|
|
242
|
+
"count_scoped_variable_sets(uuid, uuid, text)",
|
|
243
|
+
"mutate_scoped_variable_set(uuid, uuid, uuid, text, text, boolean, text, boolean, text, text, boolean)",
|
|
244
|
+
"read_scoped_variable_set_secret(uuid, uuid, uuid, text, text, text, uuid, uuid, uuid, integer)",
|
|
245
|
+
"materialize_scoped_variable_set_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid)",
|
|
246
|
+
"materialize_scoped_variable_set_for_session(uuid, uuid, uuid, uuid)",
|
|
247
|
+
] as const;
|
|
248
|
+
const SCOPED_COMPUTE_CAPABILITY_PREDICATE_ROUTINE = "scoped_compute_capability_active(text)";
|
|
249
|
+
const SCOPED_COMPUTE_CAPABILITY_TABLE = "scoped_compute_capabilities";
|
|
250
|
+
const CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE = "connection_tenancy_backfill_capabilities";
|
|
251
|
+
const CONNECTION_TENANCY_BACKFILL_CAPABILITY_PREDICATE_ROUTINE =
|
|
252
|
+
"connection_tenancy_backfill_capability_active(uuid)";
|
|
253
|
+
const SCOPED_COMPUTE_AUTHORITY_ROUTINES = [
|
|
254
|
+
"create_scoped_rig(uuid, uuid, text, text, text, text, jsonb, boolean)",
|
|
255
|
+
"list_scoped_rigs(uuid, uuid, uuid, text, text)",
|
|
256
|
+
"count_scoped_rigs(uuid, uuid, text)",
|
|
257
|
+
"mutate_scoped_rig(uuid, uuid, uuid, text, text, boolean, text, boolean, boolean)",
|
|
258
|
+
"finalize_scoped_enrollment(uuid, uuid, text, text, boolean, boolean, text, text, text, boolean)",
|
|
259
|
+
"list_scoped_enrollments(uuid, uuid, uuid, text)",
|
|
260
|
+
"get_scoped_sandbox(uuid, uuid, uuid)",
|
|
261
|
+
"authorize_scoped_sandbox_attach(uuid, uuid, uuid)",
|
|
262
|
+
"materialize_scoped_rig_version_for_attempt(uuid, uuid, uuid, uuid, uuid, integer)",
|
|
263
|
+
"authorize_session_attempt_personal_machine(uuid, uuid, uuid, uuid, uuid, integer, uuid)",
|
|
264
|
+
"assert_session_attempt_personal_machine(uuid, uuid, uuid, uuid, uuid, integer, uuid, boolean)",
|
|
265
|
+
"list_scoped_machine_dependent_sessions(uuid, uuid, uuid)",
|
|
266
|
+
"detach_scoped_machine_dependent_sessions(uuid, uuid, uuid)",
|
|
267
|
+
] as const;
|
|
75
268
|
const CANONICAL_HUMAN_IDENTITY_ROUTINES = [
|
|
76
269
|
"ensure_canonical_human_identity(text, text)",
|
|
77
270
|
"validate_canonical_human_session(text, text, boolean)",
|
|
@@ -91,17 +284,130 @@ const TASK_NOTE_CAPABILITY_ROUTINES = [
|
|
|
91
284
|
"create_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, integer)",
|
|
92
285
|
"archive_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, integer, text)",
|
|
93
286
|
"list_task_notes_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, boolean, integer)",
|
|
287
|
+
"replace_task_note_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, integer, text, text, integer, text)",
|
|
288
|
+
"resolve_task_note_knowledge_promotion_source(uuid, uuid, uuid, uuid, uuid, integer, uuid, integer, text, text, text)",
|
|
289
|
+
] as const;
|
|
290
|
+
const COMPANY_BRAIN_CONTEXT_SELECTION_ROUTINE =
|
|
291
|
+
"company_brain_context_get_or_create_selection(uuid, uuid, uuid, uuid, uuid, integer)";
|
|
292
|
+
const COMPANY_BRAIN_CONTEXT_INSPECTION_ROUTINE =
|
|
293
|
+
"company_brain_inspect_context_receipts(uuid, uuid, text, uuid, timestamp with time zone, uuid, integer)";
|
|
294
|
+
const GOVERNED_LEARNING_EVALUATION_ROUTINE =
|
|
295
|
+
"evaluate_governed_learning_proposal(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid, uuid, uuid)";
|
|
296
|
+
const GOVERNED_LEARNING_ACTIVATION_ROUTINES = [
|
|
297
|
+
"activate_governed_learning_decision(uuid, uuid, uuid, uuid)",
|
|
298
|
+
"activate_human_confirmed_learning_decision(uuid, uuid, uuid, uuid, uuid)",
|
|
299
|
+
"confirm_remember_knowledge_claim(uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)",
|
|
300
|
+
"undo_governed_learning_activation(uuid, uuid, uuid, uuid)",
|
|
301
|
+
] as const;
|
|
302
|
+
const GOVERNED_LEARNING_INSPECTION_ROUTINES = [
|
|
303
|
+
"inspect_governed_learning_decisions(uuid, uuid, text, integer)",
|
|
304
|
+
"inspect_governed_learning_activations(uuid, uuid, text, integer)",
|
|
305
|
+
"inspect_governed_learning_activation_undos(uuid, uuid, text, integer)",
|
|
306
|
+
] as const;
|
|
307
|
+
const GOVERNED_LEARNING_INSPECTION_AUTHORITY_TABLES = [
|
|
308
|
+
"governed_learning_decision_receipts",
|
|
309
|
+
"governed_learning_activation_receipts",
|
|
310
|
+
"governed_learning_activation_undo_receipts",
|
|
311
|
+
"sessions",
|
|
312
|
+
] as const;
|
|
313
|
+
const COMPANY_PROFILE_AGENT_ADMIN_ROUTINES = [
|
|
314
|
+
"propose_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, text, text, text)",
|
|
315
|
+
"confirm_company_profile_for_attempt(uuid, uuid, uuid, uuid, uuid, integer, uuid, uuid, uuid)",
|
|
316
|
+
] as const;
|
|
317
|
+
const COMPANY_PROFILE_AGENT_ADMIN_AUTHORITY_TABLES = [
|
|
318
|
+
"company_profile_activation_events",
|
|
319
|
+
"company_profile_agent_confirmation_receipts",
|
|
320
|
+
"company_profile_agent_proposal_receipts",
|
|
321
|
+
"company_profile_heads",
|
|
322
|
+
"company_profile_revisions",
|
|
323
|
+
"managed_accounts",
|
|
324
|
+
"organization_memberships",
|
|
325
|
+
"session_human_input_requests",
|
|
326
|
+
"session_turn_attempts",
|
|
327
|
+
"session_turns",
|
|
328
|
+
"sessions",
|
|
329
|
+
"workspaces",
|
|
330
|
+
] as const;
|
|
331
|
+
const GOVERNED_LEARNING_EVALUATION_AUTHORITY_TABLES = [
|
|
332
|
+
"document_chunks",
|
|
333
|
+
"documents",
|
|
334
|
+
"governed_learning_decision_receipts",
|
|
335
|
+
"knowledge_change_proposals",
|
|
336
|
+
"knowledge_claim_evidence",
|
|
337
|
+
"knowledge_claim_relations",
|
|
338
|
+
"knowledge_claim_reviews",
|
|
339
|
+
"knowledge_claims",
|
|
340
|
+
"knowledge_document_versions",
|
|
341
|
+
"knowledge_providers",
|
|
342
|
+
"knowledge_source_acl_versions",
|
|
343
|
+
"knowledge_source_objects",
|
|
344
|
+
"knowledge_sources",
|
|
345
|
+
"session_attempt_interruptions",
|
|
346
|
+
"session_turn_attempts",
|
|
347
|
+
"session_turns",
|
|
348
|
+
"sessions",
|
|
349
|
+
"task_notes",
|
|
350
|
+
"workspace_learning_policy_snapshots",
|
|
351
|
+
"workspaces",
|
|
352
|
+
] as const;
|
|
353
|
+
const GOVERNED_LEARNING_ACTIVATION_AUTHORITY_TABLES = [
|
|
354
|
+
...GOVERNED_LEARNING_EVALUATION_AUTHORITY_TABLES,
|
|
355
|
+
"company_brain_preference_proposal_receipts",
|
|
356
|
+
"governed_learning_activation_receipts",
|
|
357
|
+
"governed_learning_activation_undo_receipts",
|
|
358
|
+
"preference_registry_events",
|
|
359
|
+
"preference_registry_preferences",
|
|
360
|
+
"preference_registry_revisions",
|
|
361
|
+
"remember_knowledge_confirmation_receipts",
|
|
362
|
+
"session_human_input_requests",
|
|
363
|
+
"workspace_instruction_policy_activation_events",
|
|
364
|
+
"workspace_instruction_policy_deactivation_events",
|
|
365
|
+
"workspace_instruction_policy_heads",
|
|
366
|
+
"workspace_instruction_policy_onboarding_proposals",
|
|
367
|
+
"workspace_instruction_policy_revisions",
|
|
368
|
+
"workspace_learning_policy_heads",
|
|
369
|
+
"workspace_learning_policy_revisions",
|
|
94
370
|
] as const;
|
|
95
371
|
const TRANSITION_SESSION_VISIBILITY_ROUTINE =
|
|
96
|
-
"transition_session_visibility(uuid, uuid, uuid, text, text, integer, text, text)";
|
|
372
|
+
"transition_session_visibility(uuid, uuid, uuid, text, text, integer, text, text, integer)";
|
|
373
|
+
const LEGACY_FORK_SESSION_CONTENT_ROUTINE =
|
|
374
|
+
"fork_session_content(uuid, uuid, uuid, text, uuid, text, text, text, integer)";
|
|
97
375
|
const FORK_SESSION_CONTENT_ROUTINE =
|
|
98
|
-
"fork_session_content(uuid, uuid, uuid, text, uuid, text, text, text)";
|
|
376
|
+
"fork_session_content(uuid, uuid, uuid, text, uuid, text, boolean, text, text, integer)";
|
|
377
|
+
const REPLAY_APPLIED_SESSION_FORK_ROUTINE =
|
|
378
|
+
"replay_applied_session_fork(uuid, uuid, uuid, text, uuid, text, boolean, text, text, integer)";
|
|
379
|
+
const SESSION_TENANCY_ACTIVATED_ROUTINE = "session_tenancy_product_activated(uuid, integer)";
|
|
380
|
+
const SESSION_TENANCY_ANY_ACTIVATION_ROUTINE = "session_tenancy_any_product_activation()";
|
|
381
|
+
const SESSION_TENANCY_QUIESCENCE_ROUTINE =
|
|
382
|
+
"assert_session_tenancy_quiescent(uuid, uuid, uuid, boolean)";
|
|
383
|
+
const TENANCY_BACKFILL_ACTIVATION_EVIDENCE_ROUTINE =
|
|
384
|
+
"check_tenancy_backfill_activation_evidence(uuid)";
|
|
385
|
+
const SESSION_VISIBILITY_LIFECYCLE_CAPABILITY_ROUTINE =
|
|
386
|
+
"session_visibility_lifecycle_capability_held()";
|
|
387
|
+
const PRIVATE_SESSION_CREATE_CAPABILITY_ROUTINES = [
|
|
388
|
+
"open_private_session_create_capability(uuid, uuid, uuid, text)",
|
|
389
|
+
"open_private_child_session_create_capability(uuid, uuid, uuid, uuid, uuid, uuid, integer)",
|
|
390
|
+
"close_private_session_create_capability(uuid)",
|
|
391
|
+
] as const;
|
|
99
392
|
const SESSION_AUTHORITY_ROUTINES = new Set<string>([
|
|
393
|
+
LEGACY_FORK_SESSION_CONTENT_ROUTINE,
|
|
100
394
|
FORK_SESSION_CONTENT_ROUTINE,
|
|
395
|
+
REPLAY_APPLIED_SESSION_FORK_ROUTINE,
|
|
396
|
+
SESSION_TENANCY_ACTIVATED_ROUTINE,
|
|
397
|
+
SESSION_TENANCY_ANY_ACTIVATION_ROUTINE,
|
|
398
|
+
SESSION_TENANCY_QUIESCENCE_ROUTINE,
|
|
399
|
+
PERSONAL_RESOURCE_ATTEMPT_RESOLVER_ROUTINE,
|
|
400
|
+
...USER_RESOURCE_LIFECYCLE_ROUTINES,
|
|
401
|
+
...CONNECTION_AUTHORITY_ROUTINES,
|
|
402
|
+
...SCHEDULED_PERSONAL_RESOURCE_ROUTINES,
|
|
101
403
|
SESSION_PRIVATE_ACTOR_VISIBLE_ROUTINE,
|
|
102
404
|
SESSION_REFERENCE_VISIBLE_ROUTINE,
|
|
405
|
+
SESSION_VISIBILITY_LIFECYCLE_CAPABILITY_ROUTINE,
|
|
406
|
+
...PRIVATE_SESSION_CREATE_CAPABILITY_ROUTINES,
|
|
103
407
|
TRANSITION_SESSION_VISIBILITY_ROUTINE,
|
|
104
408
|
...TASK_NOTE_CAPABILITY_ROUTINES,
|
|
409
|
+
COMPANY_BRAIN_CONTEXT_SELECTION_ROUTINE,
|
|
410
|
+
COMPANY_BRAIN_CONTEXT_INSPECTION_ROUTINE,
|
|
105
411
|
]);
|
|
106
412
|
const XAI_CREATE_CREDENTIAL_ROUTINE =
|
|
107
413
|
"create_xai_subscription_credential(uuid, uuid, text, text, text, text, text, text, text, timestamp with time zone)";
|
|
@@ -122,7 +428,17 @@ const XAI_AUTHORITY_TABLES = [
|
|
|
122
428
|
] as const;
|
|
123
429
|
|
|
124
430
|
export const RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES = [
|
|
431
|
+
COMPANY_BRAIN_CONTEXT_INSPECTION_ROUTINE,
|
|
432
|
+
COMPANY_BRAIN_CONTEXT_SELECTION_ROUTINE,
|
|
433
|
+
...COMPANY_PROFILE_AGENT_ADMIN_ROUTINES,
|
|
434
|
+
GOVERNED_LEARNING_EVALUATION_ROUTINE,
|
|
435
|
+
...GOVERNED_LEARNING_ACTIVATION_ROUTINES,
|
|
436
|
+
...GOVERNED_LEARNING_INSPECTION_ROUTINES,
|
|
125
437
|
FORK_SESSION_CONTENT_ROUTINE,
|
|
438
|
+
LEGACY_FORK_SESSION_CONTENT_ROUTINE,
|
|
439
|
+
REPLAY_APPLIED_SESSION_FORK_ROUTINE,
|
|
440
|
+
SESSION_TENANCY_ACTIVATED_ROUTINE,
|
|
441
|
+
SESSION_TENANCY_ANY_ACTIVATION_ROUTINE,
|
|
126
442
|
XAI_AUTHORITY_LIVE_ROUTINE,
|
|
127
443
|
XAI_CREATE_CREDENTIAL_ROUTINE,
|
|
128
444
|
XAI_DISCONNECT_CREDENTIAL_ROUTINE,
|
|
@@ -130,9 +446,24 @@ export const RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES = [
|
|
|
130
446
|
GOOGLE_DRIVE_FILE_AUTHORIZATION_ROUTINE,
|
|
131
447
|
KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE,
|
|
132
448
|
MANAGED_HUMAN_PERSONAL_WORKSPACE_ROUTINE,
|
|
449
|
+
...ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES,
|
|
450
|
+
...ORGANIZATION_PRIVATE_SESSION_ROUTINES,
|
|
451
|
+
...PRIVATE_SESSION_CREATE_CAPABILITY_ROUTINES,
|
|
452
|
+
PERSONAL_RESOURCE_ATTEMPT_RESOLVER_ROUTINE,
|
|
453
|
+
...USER_RESOURCE_LIFECYCLE_ROUTINES,
|
|
454
|
+
PREFERENCE_KNOWLEDGE_PROPOSAL_ROUTINE,
|
|
455
|
+
...VARIABLE_SET_AUTHORITY_ROUTINES,
|
|
456
|
+
...CONNECTION_AUTHORITY_ROUTINES,
|
|
457
|
+
...PERSONAL_GITHUB_REPOSITORY_AUTHORITY_ROUTINES,
|
|
458
|
+
...PERSONAL_DOCUMENT_AUTHORITY_ROUTINES,
|
|
459
|
+
...DOCUMENT_MIGRATION_AUTHORITY_ROUTINES,
|
|
460
|
+
...SCOPED_COMPUTE_AUTHORITY_ROUTINES,
|
|
461
|
+
...SCHEDULED_PERSONAL_RESOURCE_ROUTINES,
|
|
133
462
|
...CANONICAL_HUMAN_IDENTITY_ROUTINES,
|
|
463
|
+
...TASK_NOTE_CAPABILITY_ROUTINES,
|
|
134
464
|
SESSION_PRIVATE_ACTOR_VISIBLE_ROUTINE,
|
|
135
465
|
SESSION_REFERENCE_VISIBLE_ROUTINE,
|
|
466
|
+
SESSION_VISIBILITY_LIFECYCLE_CAPABILITY_ROUTINE,
|
|
136
467
|
TRANSITION_SESSION_VISIBILITY_ROUTINE,
|
|
137
468
|
XAI_POOL_VISIBLE_ROUTINE,
|
|
138
469
|
XAI_RESOLVE_POOL_ROUTINE,
|
|
@@ -140,6 +471,13 @@ export const RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES = [
|
|
|
140
471
|
XAI_SNAPSHOT_VALIDATOR_ROUTINE,
|
|
141
472
|
] as const;
|
|
142
473
|
|
|
474
|
+
/** Owner-internal helpers that must exist but must never be callable by the runtime role. */
|
|
475
|
+
export const RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES = [
|
|
476
|
+
ORGANIZATION_PRIVATE_SESSIONS_ENABLED_ROUTINE,
|
|
477
|
+
SESSION_TENANCY_QUIESCENCE_ROUTINE,
|
|
478
|
+
TENANCY_BACKFILL_ACTIVATION_EVIDENCE_ROUTINE,
|
|
479
|
+
] as const;
|
|
480
|
+
|
|
143
481
|
export const RUNTIME_TARGET_SCHEMA_INVOKER_ROUTINES = [
|
|
144
482
|
SESSION_REFERENCE_VISIBLE_ROUTINE,
|
|
145
483
|
XAI_SNAPSHOT_VALIDATOR_ROUTINE,
|
|
@@ -160,6 +498,12 @@ export const FORCE_RLS_TABLES = [
|
|
|
160
498
|
"attached_browser_inventories",
|
|
161
499
|
"audit_events",
|
|
162
500
|
"auth_runs",
|
|
501
|
+
"automation_run_event_links",
|
|
502
|
+
"automation_runs",
|
|
503
|
+
"automation_sources",
|
|
504
|
+
"automation_trigger_events",
|
|
505
|
+
"automation_trigger_revisions",
|
|
506
|
+
"automation_triggers",
|
|
163
507
|
"billing_customers",
|
|
164
508
|
"browser_identities",
|
|
165
509
|
"browser_revision_components",
|
|
@@ -193,7 +537,12 @@ export const FORCE_RLS_TABLES = [
|
|
|
193
537
|
"codex_reset_redemption_attempts",
|
|
194
538
|
"codex_rotation_settings",
|
|
195
539
|
"codex_subscription_credentials",
|
|
540
|
+
"company_brain_context_selection_receipts",
|
|
541
|
+
"company_brain_preference_proposal_receipts",
|
|
542
|
+
"company_brain_turn_context_snapshots",
|
|
196
543
|
"company_profile_activation_events",
|
|
544
|
+
"company_profile_agent_confirmation_receipts",
|
|
545
|
+
"company_profile_agent_proposal_receipts",
|
|
197
546
|
"company_profile_heads",
|
|
198
547
|
"company_profile_revisions",
|
|
199
548
|
"company_profile_snapshots",
|
|
@@ -201,13 +550,19 @@ export const FORCE_RLS_TABLES = [
|
|
|
201
550
|
"computer_session_associations",
|
|
202
551
|
"computer_sessions",
|
|
203
552
|
"connection_disconnect_operations",
|
|
553
|
+
"connection_use_audit_facts",
|
|
554
|
+
"connection_use_once_consumption_receipts",
|
|
204
555
|
"connections",
|
|
205
556
|
"connector_action_policies",
|
|
206
557
|
"connector_action_requests",
|
|
207
558
|
"credit_ledger_entries",
|
|
208
559
|
"device_enrollment_requests",
|
|
560
|
+
"document_authority_reclassifications",
|
|
209
561
|
"document_bases",
|
|
210
562
|
"document_chunks",
|
|
563
|
+
"document_default_collection_backfill_operations",
|
|
564
|
+
"document_default_collection_backfill_receipts",
|
|
565
|
+
"document_default_collection_backfill_runs",
|
|
211
566
|
"documents",
|
|
212
567
|
"editable_artifact_blob_refs",
|
|
213
568
|
"editable_artifact_idempotency_receipts",
|
|
@@ -234,6 +589,9 @@ export const FORCE_RLS_TABLES = [
|
|
|
234
589
|
"github_installations",
|
|
235
590
|
"google_drive_object_acl_evidence",
|
|
236
591
|
"google_drive_object_acl_principals",
|
|
592
|
+
"governed_learning_activation_receipts",
|
|
593
|
+
"governed_learning_activation_undo_receipts",
|
|
594
|
+
"governed_learning_decision_receipts",
|
|
237
595
|
"host_export_config",
|
|
238
596
|
"host_export_consumers",
|
|
239
597
|
"host_export_cursor_state",
|
|
@@ -283,16 +641,37 @@ export const FORCE_RLS_TABLES = [
|
|
|
283
641
|
"model_call_facts",
|
|
284
642
|
"network_routes",
|
|
285
643
|
"new_session_drafts",
|
|
644
|
+
"organization_invitation_binding_events",
|
|
645
|
+
"organization_membership_invitations",
|
|
646
|
+
"organization_membership_lifecycle_events",
|
|
647
|
+
"organization_membership_operation_receipts",
|
|
286
648
|
"organization_memberships",
|
|
649
|
+
"organization_private_session_setting_events",
|
|
650
|
+
"organization_private_session_settings",
|
|
651
|
+
"organization_profile_events",
|
|
652
|
+
"organization_shared_workspace_administration_capabilities",
|
|
287
653
|
"organization_user_resource_authorities",
|
|
288
654
|
"organization_user_resource_grants",
|
|
655
|
+
"organization_user_retention_deletion_events",
|
|
656
|
+
"organization_user_retention_deletions",
|
|
657
|
+
"organization_user_retention_object_deletion_receipts",
|
|
658
|
+
"organization_user_retention_object_obligations",
|
|
289
659
|
"organization_user_retention_policies",
|
|
290
660
|
"pack_installation_components",
|
|
291
661
|
"pack_installations",
|
|
662
|
+
"personal_document_once_consumption_receipts",
|
|
663
|
+
"personal_github_repository_selection_heads",
|
|
664
|
+
"personal_github_repository_selection_operations",
|
|
665
|
+
"personal_github_repository_selections",
|
|
666
|
+
"personal_resource_once_consumption_receipts",
|
|
667
|
+
"pr_review_app_registrations",
|
|
668
|
+
"pr_review_repository_bindings",
|
|
292
669
|
"preference_registry_events",
|
|
293
670
|
"preference_registry_preferences",
|
|
294
671
|
"preference_registry_revisions",
|
|
295
672
|
"preference_registry_snapshots",
|
|
673
|
+
"private_session_create_capabilities",
|
|
674
|
+
"remember_knowledge_confirmation_receipts",
|
|
296
675
|
"retained_screenshot_artifacts",
|
|
297
676
|
"rig_changes",
|
|
298
677
|
"rig_versions",
|
|
@@ -305,11 +684,26 @@ export const FORCE_RLS_TABLES = [
|
|
|
305
684
|
"sandbox_session_envelopes",
|
|
306
685
|
"sandbox_workspace_mutation_admissions",
|
|
307
686
|
"sandboxes",
|
|
687
|
+
"scheduled_task_connection_authority_snapshots",
|
|
688
|
+
"scheduled_task_personal_resource_authorities",
|
|
689
|
+
"scheduled_task_personal_resource_snapshots",
|
|
690
|
+
"scheduled_task_reusable_connection_materializations",
|
|
691
|
+
"scheduled_task_revision_authorities",
|
|
692
|
+
"scheduled_task_run_connection_authority_snapshots",
|
|
693
|
+
"scheduled_task_run_personal_resource_admissions",
|
|
694
|
+
"scheduled_task_run_personal_resource_once_receipts",
|
|
695
|
+
"scheduled_task_run_personal_resource_snapshots",
|
|
308
696
|
"scheduled_task_runs",
|
|
309
697
|
"scheduled_tasks",
|
|
310
698
|
"session_attempt_codemode_calls",
|
|
699
|
+
"session_attempt_connected_machine_authorizations",
|
|
311
700
|
"session_attempt_interruptions",
|
|
701
|
+
"session_attempt_personal_document_admissions",
|
|
702
|
+
"session_attempt_personal_document_snapshots",
|
|
703
|
+
"session_attempt_personal_resource_admissions",
|
|
704
|
+
"session_attempt_personal_resource_snapshots",
|
|
312
705
|
"session_attempt_tool_catalogs",
|
|
706
|
+
"session_background_commands",
|
|
313
707
|
"session_command_receipts",
|
|
314
708
|
"session_events",
|
|
315
709
|
"session_goal_revisions",
|
|
@@ -329,37 +723,52 @@ export const FORCE_RLS_TABLES = [
|
|
|
329
723
|
"session_stream_acknowledgments",
|
|
330
724
|
"session_system_update_outbox",
|
|
331
725
|
"session_system_updates",
|
|
726
|
+
"session_tenancy_activations",
|
|
332
727
|
"session_turn_attempts",
|
|
728
|
+
"session_turn_startup_milestones",
|
|
333
729
|
"session_turns",
|
|
334
730
|
"session_visibility_write_capabilities",
|
|
335
731
|
"session_workflow_wake_outbox",
|
|
336
732
|
"sessions",
|
|
337
733
|
"site_auth_connections",
|
|
734
|
+
"slack_app_home_refreshes",
|
|
338
735
|
"slack_bot_delete_operations",
|
|
339
736
|
"slack_bot_post_operations",
|
|
340
737
|
"slack_bot_update_operations",
|
|
341
738
|
"slack_bot_user_links",
|
|
739
|
+
"slack_channel_routes",
|
|
342
740
|
"slack_installation_bindings",
|
|
343
741
|
"slack_interaction_action_handles",
|
|
344
742
|
"slack_interaction_inbox",
|
|
345
743
|
"slack_interaction_progress_deliveries",
|
|
346
744
|
"slack_interactions",
|
|
745
|
+
"slack_route_prompt_options",
|
|
746
|
+
"slack_route_prompts",
|
|
347
747
|
"slack_shared_task_origins",
|
|
348
748
|
"slack_task_policy_activation_events",
|
|
349
749
|
"slack_task_policy_heads",
|
|
350
750
|
"slack_task_policy_revisions",
|
|
751
|
+
"slack_user_dm_routes",
|
|
351
752
|
"slack_user_link_access_request_operations",
|
|
352
753
|
"slack_user_link_access_requests",
|
|
353
754
|
"social_connections",
|
|
354
755
|
"social_posts",
|
|
355
756
|
"task_note_events",
|
|
757
|
+
"task_note_knowledge_promotion_capabilities",
|
|
758
|
+
"task_note_replacement_receipts",
|
|
356
759
|
"task_note_write_capabilities",
|
|
357
760
|
"task_notes",
|
|
358
761
|
"temporal_schedule_cleanup_outbox",
|
|
762
|
+
"tenancy_backfill_receipts",
|
|
763
|
+
"tenancy_backfill_unresolved_rows",
|
|
359
764
|
"transcription_recording_chunks",
|
|
360
765
|
"transcription_recording_objects",
|
|
361
766
|
"transcription_recording_segments",
|
|
362
767
|
"transcription_recordings",
|
|
768
|
+
"turn_connection_authority_snapshots",
|
|
769
|
+
"turn_personal_resource_attachment_receipts",
|
|
770
|
+
"turn_personal_resource_once_receipts",
|
|
771
|
+
"turn_personal_resource_snapshots",
|
|
363
772
|
"usage_events",
|
|
364
773
|
"video_generation_operations",
|
|
365
774
|
"video_generation_references",
|
|
@@ -370,6 +779,7 @@ export const FORCE_RLS_TABLES = [
|
|
|
370
779
|
"workspace_control_events",
|
|
371
780
|
"workspace_inference_controls",
|
|
372
781
|
"workspace_instruction_policy_activation_events",
|
|
782
|
+
"workspace_instruction_policy_deactivation_events",
|
|
373
783
|
"workspace_instruction_policy_heads",
|
|
374
784
|
"workspace_instruction_policy_onboarding_proposals",
|
|
375
785
|
"workspace_instruction_policy_revisions",
|
|
@@ -405,6 +815,7 @@ export const NON_RLS_RUNTIME_TABLES = [
|
|
|
405
815
|
"auth_sessions",
|
|
406
816
|
"auth_users",
|
|
407
817
|
"auth_verifications",
|
|
818
|
+
"automation_webhook_endpoints",
|
|
408
819
|
"integration_oauth_clients",
|
|
409
820
|
"managed_accounts",
|
|
410
821
|
"nested_agent_depth_configuration",
|
|
@@ -427,6 +838,13 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
427
838
|
"auth_sessions",
|
|
428
839
|
"auth_users",
|
|
429
840
|
"auth_verifications",
|
|
841
|
+
"automation_run_event_links",
|
|
842
|
+
"automation_runs",
|
|
843
|
+
"automation_sources",
|
|
844
|
+
"automation_trigger_events",
|
|
845
|
+
"automation_trigger_revisions",
|
|
846
|
+
"automation_triggers",
|
|
847
|
+
"automation_webhook_endpoints",
|
|
430
848
|
"billing_customers",
|
|
431
849
|
"browser_session_associations",
|
|
432
850
|
"capability_catalog_items",
|
|
@@ -484,6 +902,8 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
484
902
|
"new_session_drafts",
|
|
485
903
|
"pack_installation_components",
|
|
486
904
|
"pack_installations",
|
|
905
|
+
"pr_review_app_registrations",
|
|
906
|
+
"pr_review_repository_bindings",
|
|
487
907
|
"retained_screenshot_artifacts",
|
|
488
908
|
"rig_changes",
|
|
489
909
|
"rig_versions",
|
|
@@ -496,9 +916,8 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
496
916
|
"sandbox_session_envelopes",
|
|
497
917
|
"sandbox_workspace_mutation_admissions",
|
|
498
918
|
"sandboxes",
|
|
499
|
-
"scheduled_task_runs",
|
|
500
|
-
"scheduled_tasks",
|
|
501
919
|
"session_attempt_interruptions",
|
|
920
|
+
"session_background_commands",
|
|
502
921
|
"session_command_receipts",
|
|
503
922
|
"session_events",
|
|
504
923
|
"session_goals",
|
|
@@ -520,14 +939,19 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
520
939
|
"session_turns",
|
|
521
940
|
"session_workflow_wake_outbox",
|
|
522
941
|
"sessions",
|
|
942
|
+
"slack_app_home_refreshes",
|
|
523
943
|
"slack_bot_delete_operations",
|
|
524
944
|
"slack_bot_post_operations",
|
|
525
945
|
"slack_bot_update_operations",
|
|
526
946
|
"slack_bot_user_links",
|
|
947
|
+
"slack_channel_routes",
|
|
527
948
|
"slack_interaction_action_handles",
|
|
528
949
|
"slack_interaction_inbox",
|
|
529
950
|
"slack_interaction_progress_deliveries",
|
|
530
951
|
"slack_interactions",
|
|
952
|
+
"slack_route_prompt_options",
|
|
953
|
+
"slack_route_prompts",
|
|
954
|
+
"slack_user_dm_routes",
|
|
531
955
|
"social_connections",
|
|
532
956
|
"social_posts",
|
|
533
957
|
"stripe_webhook_events",
|
|
@@ -547,8 +971,6 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
547
971
|
"workspace_model_policies",
|
|
548
972
|
"workspace_packs",
|
|
549
973
|
"workspace_screenshot_quotas",
|
|
550
|
-
"workspace_variable_set_variables",
|
|
551
|
-
"workspace_variable_sets",
|
|
552
974
|
"workspace_video_generation_policies",
|
|
553
975
|
"workspace_video_generation_quotas",
|
|
554
976
|
"workspaces",
|
|
@@ -564,16 +986,19 @@ export const RUNTIME_READ_ONLY_TABLES = [
|
|
|
564
986
|
"company_profile_activation_events",
|
|
565
987
|
"company_profile_heads",
|
|
566
988
|
"company_profile_snapshots",
|
|
989
|
+
"document_authority_reclassifications",
|
|
567
990
|
"knowledge_lifecycle_events",
|
|
568
991
|
"knowledge_memory_lifecycle_events",
|
|
569
992
|
"knowledge_memory_relationships",
|
|
570
993
|
"nested_agent_depth_configuration",
|
|
571
994
|
"preference_registry_events",
|
|
572
995
|
"preference_registry_snapshots",
|
|
996
|
+
"session_tenancy_activations",
|
|
573
997
|
"slack_installation_bindings",
|
|
574
998
|
"slack_task_policy_activation_events",
|
|
575
999
|
"slack_task_policy_heads",
|
|
576
1000
|
"slack_task_policy_revisions",
|
|
1001
|
+
"workspace_instruction_policy_deactivation_events",
|
|
577
1002
|
"workspace_instruction_policy_snapshots",
|
|
578
1003
|
"workspace_learning_policy_activation_events",
|
|
579
1004
|
"workspace_learning_policy_heads",
|
|
@@ -659,7 +1084,10 @@ export const RUNTIME_READ_INSERT_UPDATE_TABLES = [
|
|
|
659
1084
|
"interaction_operations",
|
|
660
1085
|
"interaction_resource_operations",
|
|
661
1086
|
"network_routes",
|
|
1087
|
+
"scheduled_task_runs",
|
|
1088
|
+
"scheduled_tasks",
|
|
662
1089
|
"session_attempt_codemode_calls",
|
|
1090
|
+
"session_turn_startup_milestones",
|
|
663
1091
|
"site_auth_connections",
|
|
664
1092
|
"slack_user_link_access_requests",
|
|
665
1093
|
"workspace_interaction_revisions",
|
|
@@ -674,21 +1102,77 @@ export const PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
|
674
1102
|
"canonical_human_identity_operations",
|
|
675
1103
|
"canonical_human_identity_subjects",
|
|
676
1104
|
"canonical_human_login_bindings",
|
|
1105
|
+
"company_brain_context_selection_receipts",
|
|
1106
|
+
"company_brain_preference_proposal_receipts",
|
|
1107
|
+
"company_brain_turn_context_snapshots",
|
|
1108
|
+
"company_profile_agent_confirmation_receipts",
|
|
1109
|
+
"company_profile_agent_proposal_receipts",
|
|
1110
|
+
"connection_use_audit_facts",
|
|
1111
|
+
"connection_use_once_consumption_receipts",
|
|
1112
|
+
"document_default_collection_backfill_operations",
|
|
1113
|
+
"document_default_collection_backfill_receipts",
|
|
1114
|
+
"document_default_collection_backfill_runs",
|
|
677
1115
|
"editable_artifact_live_tickets",
|
|
678
1116
|
"editable_artifact_scope_authorization_heads",
|
|
1117
|
+
"governed_learning_activation_receipts",
|
|
1118
|
+
"governed_learning_activation_undo_receipts",
|
|
1119
|
+
"governed_learning_decision_receipts",
|
|
679
1120
|
"host_export_config",
|
|
680
1121
|
"host_export_consumers",
|
|
681
1122
|
"host_export_cursor_state",
|
|
682
1123
|
"host_export_dead_letters",
|
|
683
1124
|
"host_export_outbox",
|
|
1125
|
+
"organization_invitation_binding_events",
|
|
1126
|
+
"organization_membership_invitations",
|
|
1127
|
+
"organization_membership_lifecycle_events",
|
|
1128
|
+
"organization_membership_operation_receipts",
|
|
684
1129
|
"organization_memberships",
|
|
1130
|
+
"organization_private_session_setting_events",
|
|
1131
|
+
"organization_private_session_settings",
|
|
1132
|
+
"organization_profile_events",
|
|
1133
|
+
"organization_shared_workspace_administration_capabilities",
|
|
685
1134
|
"organization_user_resource_authorities",
|
|
686
1135
|
"organization_user_resource_grants",
|
|
1136
|
+
"organization_user_retention_deletion_events",
|
|
1137
|
+
"organization_user_retention_deletions",
|
|
1138
|
+
"organization_user_retention_object_deletion_receipts",
|
|
1139
|
+
"organization_user_retention_object_obligations",
|
|
687
1140
|
"organization_user_retention_policies",
|
|
1141
|
+
"personal_document_once_consumption_receipts",
|
|
1142
|
+
"personal_github_repository_selection_heads",
|
|
1143
|
+
"personal_github_repository_selection_operations",
|
|
1144
|
+
"personal_github_repository_selections",
|
|
1145
|
+
"personal_resource_once_consumption_receipts",
|
|
1146
|
+
"private_session_create_capabilities",
|
|
1147
|
+
"remember_knowledge_confirmation_receipts",
|
|
1148
|
+
"scheduled_task_connection_authority_snapshots",
|
|
1149
|
+
"scheduled_task_personal_resource_authorities",
|
|
1150
|
+
"scheduled_task_personal_resource_snapshots",
|
|
1151
|
+
"scheduled_task_reusable_connection_materializations",
|
|
1152
|
+
"scheduled_task_revision_authorities",
|
|
1153
|
+
"scheduled_task_run_connection_authority_snapshots",
|
|
1154
|
+
"scheduled_task_run_personal_resource_admissions",
|
|
1155
|
+
"scheduled_task_run_personal_resource_once_receipts",
|
|
1156
|
+
"scheduled_task_run_personal_resource_snapshots",
|
|
1157
|
+
"session_attempt_connected_machine_authorizations",
|
|
1158
|
+
"session_attempt_personal_document_admissions",
|
|
1159
|
+
"session_attempt_personal_document_snapshots",
|
|
1160
|
+
"session_attempt_personal_resource_admissions",
|
|
1161
|
+
"session_attempt_personal_resource_snapshots",
|
|
688
1162
|
"session_visibility_write_capabilities",
|
|
689
1163
|
"task_note_events",
|
|
1164
|
+
"task_note_knowledge_promotion_capabilities",
|
|
1165
|
+
"task_note_replacement_receipts",
|
|
690
1166
|
"task_note_write_capabilities",
|
|
691
1167
|
"task_notes",
|
|
1168
|
+
"tenancy_backfill_receipts",
|
|
1169
|
+
"tenancy_backfill_unresolved_rows",
|
|
1170
|
+
"turn_connection_authority_snapshots",
|
|
1171
|
+
"turn_personal_resource_attachment_receipts",
|
|
1172
|
+
"turn_personal_resource_once_receipts",
|
|
1173
|
+
"turn_personal_resource_snapshots",
|
|
1174
|
+
"workspace_variable_set_variables",
|
|
1175
|
+
"workspace_variable_sets",
|
|
692
1176
|
] as const;
|
|
693
1177
|
|
|
694
1178
|
export type RuntimeTableDmlPrivilege = "SELECT" | "INSERT" | "UPDATE" | "DELETE";
|
|
@@ -728,6 +1212,7 @@ export type RuntimeDatabasePostureOptions = {
|
|
|
728
1212
|
protectedTables?: readonly string[];
|
|
729
1213
|
tablePrivileges?: RuntimeTablePrivilegeContract;
|
|
730
1214
|
protectedNoDirectDmlTables?: readonly string[];
|
|
1215
|
+
organizationTenancyCanonicalActivationEnabled?: boolean;
|
|
731
1216
|
};
|
|
732
1217
|
|
|
733
1218
|
export type RuntimeDatabaseIdentity = {
|
|
@@ -775,6 +1260,7 @@ export type RuntimeRoutinePosture = {
|
|
|
775
1260
|
name: string;
|
|
776
1261
|
owner: string;
|
|
777
1262
|
execute: boolean;
|
|
1263
|
+
publicExecute?: boolean;
|
|
778
1264
|
securityDefiner: boolean;
|
|
779
1265
|
};
|
|
780
1266
|
|
|
@@ -782,6 +1268,15 @@ export type RuntimeTargetRoutinePosture = RuntimeRoutinePosture & {
|
|
|
782
1268
|
publicExecute: boolean;
|
|
783
1269
|
};
|
|
784
1270
|
|
|
1271
|
+
export type RuntimePrivateTablePosture = {
|
|
1272
|
+
name: string;
|
|
1273
|
+
owner: string;
|
|
1274
|
+
select: boolean;
|
|
1275
|
+
insert: boolean;
|
|
1276
|
+
update: boolean;
|
|
1277
|
+
delete: boolean;
|
|
1278
|
+
};
|
|
1279
|
+
|
|
785
1280
|
export type RuntimeDatabasePosture = {
|
|
786
1281
|
identity: RuntimeDatabaseIdentity;
|
|
787
1282
|
/** Privilege-bearing role relationships; exact PG16+ management-only grants are excluded. */
|
|
@@ -790,8 +1285,10 @@ export type RuntimeDatabasePosture = {
|
|
|
790
1285
|
ownedSchemas: string[];
|
|
791
1286
|
ownedRelations: string[];
|
|
792
1287
|
tables: RuntimeTablePosture[];
|
|
1288
|
+
privateTables: RuntimePrivateTablePosture[];
|
|
793
1289
|
targetRoutines: RuntimeTargetRoutinePosture[];
|
|
794
1290
|
privateRoutines: RuntimeRoutinePosture[];
|
|
1291
|
+
sessionTenancyProductActivationPresent: boolean;
|
|
795
1292
|
};
|
|
796
1293
|
|
|
797
1294
|
export class RuntimeDatabasePostureError extends Error {
|
|
@@ -839,7 +1336,7 @@ function difference(left: ReadonlySet<string>, right: ReadonlySet<string>): stri
|
|
|
839
1336
|
return sorted([...left].filter((value) => !right.has(value)));
|
|
840
1337
|
}
|
|
841
1338
|
|
|
842
|
-
/** Inspect
|
|
1339
|
+
/** Inspect PostgreSQL catalogs plus one value-free global activation predicate; no tenant content. */
|
|
843
1340
|
export async function inspectRuntimeDatabasePosture(
|
|
844
1341
|
db: Database,
|
|
845
1342
|
options: RuntimeDatabasePostureOptions,
|
|
@@ -890,6 +1387,15 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
890
1387
|
bypassRls: identity.rolbypassrls,
|
|
891
1388
|
};
|
|
892
1389
|
|
|
1390
|
+
// The forward-only activation receipt outlives topology. Embedded/scoped
|
|
1391
|
+
// deployments must enforce the same environment interlock as standalone
|
|
1392
|
+
// FORCE-RLS deployments, so inspect the value-free predicate before the
|
|
1393
|
+
// scoped catalog fast-path.
|
|
1394
|
+
const activationRows = resultRows<{ activated: boolean }>(
|
|
1395
|
+
await tx.execute(sql`select session_tenancy_any_product_activation() as activated`),
|
|
1396
|
+
);
|
|
1397
|
+
const sessionTenancyProductActivationPresent = activationRows[0]?.activated === true;
|
|
1398
|
+
|
|
893
1399
|
// Scoped/embedded topology deliberately leaves ownership and isolation to
|
|
894
1400
|
// the host. Prove the connection identity is coherent, but do not impose
|
|
895
1401
|
// the standalone opengeni_app object/grant contract on the host's role.
|
|
@@ -901,8 +1407,10 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
901
1407
|
ownedSchemas: [],
|
|
902
1408
|
ownedRelations: [],
|
|
903
1409
|
tables: [],
|
|
1410
|
+
privateTables: [],
|
|
904
1411
|
targetRoutines: [],
|
|
905
1412
|
privateRoutines: [],
|
|
1413
|
+
sessionTenancyProductActivationPresent,
|
|
906
1414
|
};
|
|
907
1415
|
}
|
|
908
1416
|
|
|
@@ -1021,6 +1529,45 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1021
1529
|
trigger: row.can_trigger,
|
|
1022
1530
|
}));
|
|
1023
1531
|
|
|
1532
|
+
const privateTables = resultRows<{
|
|
1533
|
+
name: string;
|
|
1534
|
+
owner: string;
|
|
1535
|
+
can_select: boolean;
|
|
1536
|
+
can_insert: boolean;
|
|
1537
|
+
can_update: boolean;
|
|
1538
|
+
can_delete: boolean;
|
|
1539
|
+
}>(
|
|
1540
|
+
await tx.execute(sql`
|
|
1541
|
+
select
|
|
1542
|
+
c.relname::text as name,
|
|
1543
|
+
pg_get_userbyid(c.relowner)::text as owner,
|
|
1544
|
+
has_table_privilege(current_user, c.oid, 'SELECT') as can_select,
|
|
1545
|
+
has_table_privilege(current_user, c.oid, 'INSERT') as can_insert,
|
|
1546
|
+
has_table_privilege(current_user, c.oid, 'UPDATE') as can_update,
|
|
1547
|
+
has_table_privilege(current_user, c.oid, 'DELETE') as can_delete
|
|
1548
|
+
from pg_class c
|
|
1549
|
+
join pg_namespace n on n.oid = c.relnamespace
|
|
1550
|
+
where n.nspname = 'opengeni_private'
|
|
1551
|
+
and c.relkind in ('r', 'p')
|
|
1552
|
+
and c.relname in (
|
|
1553
|
+
${PERSONAL_RESOURCE_CAPABILITY_TABLE},
|
|
1554
|
+
${SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_TABLE},
|
|
1555
|
+
${VARIABLE_SET_CAPABILITY_TABLE},
|
|
1556
|
+
${PERSONAL_DOCUMENT_CAPABILITY_TABLE},
|
|
1557
|
+
${DOCUMENT_MIGRATION_CAPABILITY_TABLE},
|
|
1558
|
+
${SCOPED_COMPUTE_CAPABILITY_TABLE},
|
|
1559
|
+
${CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE}
|
|
1560
|
+
)
|
|
1561
|
+
`),
|
|
1562
|
+
).map((row) => ({
|
|
1563
|
+
name: row.name,
|
|
1564
|
+
owner: row.owner,
|
|
1565
|
+
select: row.can_select,
|
|
1566
|
+
insert: row.can_insert,
|
|
1567
|
+
update: row.can_update,
|
|
1568
|
+
delete: row.can_delete,
|
|
1569
|
+
}));
|
|
1570
|
+
|
|
1024
1571
|
const targetRoutines = resultRows<{
|
|
1025
1572
|
name: string;
|
|
1026
1573
|
owner: string;
|
|
@@ -1046,25 +1593,31 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1046
1593
|
and (p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')') = any(
|
|
1047
1594
|
array[
|
|
1048
1595
|
${sql.join(
|
|
1049
|
-
|
|
1596
|
+
[
|
|
1597
|
+
...RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES,
|
|
1598
|
+
...RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES,
|
|
1599
|
+
].map((name) => sql`${name}`),
|
|
1050
1600
|
sql`, `,
|
|
1051
1601
|
)}
|
|
1052
1602
|
]::text[]
|
|
1053
1603
|
)
|
|
1054
1604
|
order by p.proname, pg_catalog.oidvectortypes(p.proargtypes)
|
|
1055
1605
|
`),
|
|
1056
|
-
)
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1606
|
+
)
|
|
1607
|
+
.map((row) => ({
|
|
1608
|
+
name: row.name,
|
|
1609
|
+
owner: row.owner,
|
|
1610
|
+
execute: row.can_execute,
|
|
1611
|
+
publicExecute: row.public_execute,
|
|
1612
|
+
securityDefiner: row.security_definer,
|
|
1613
|
+
}))
|
|
1614
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
1063
1615
|
|
|
1064
1616
|
const privateRoutines = resultRows<{
|
|
1065
1617
|
name: string;
|
|
1066
1618
|
owner: string;
|
|
1067
1619
|
can_execute: boolean;
|
|
1620
|
+
public_execute: boolean;
|
|
1068
1621
|
security_definer: boolean;
|
|
1069
1622
|
}>(
|
|
1070
1623
|
await tx.execute(sql`
|
|
@@ -1072,6 +1625,11 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1072
1625
|
(p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')')::text as name,
|
|
1073
1626
|
pg_get_userbyid(p.proowner)::text as owner,
|
|
1074
1627
|
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute,
|
|
1628
|
+
exists (
|
|
1629
|
+
select 1
|
|
1630
|
+
from aclexplode(coalesce(p.proacl, acldefault('f', p.proowner))) acl
|
|
1631
|
+
where acl.grantee = 0 and acl.privilege_type = 'EXECUTE'
|
|
1632
|
+
) as public_execute,
|
|
1075
1633
|
p.prosecdef as security_definer
|
|
1076
1634
|
from pg_proc p
|
|
1077
1635
|
join pg_namespace n on n.oid = p.pronamespace
|
|
@@ -1083,6 +1641,7 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1083
1641
|
name: row.name,
|
|
1084
1642
|
owner: row.owner,
|
|
1085
1643
|
execute: row.can_execute,
|
|
1644
|
+
publicExecute: row.public_execute,
|
|
1086
1645
|
securityDefiner: row.security_definer,
|
|
1087
1646
|
}));
|
|
1088
1647
|
|
|
@@ -1093,8 +1652,10 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
1093
1652
|
ownedSchemas,
|
|
1094
1653
|
ownedRelations,
|
|
1095
1654
|
tables,
|
|
1655
|
+
privateTables,
|
|
1096
1656
|
targetRoutines,
|
|
1097
1657
|
privateRoutines,
|
|
1658
|
+
sessionTenancyProductActivationPresent,
|
|
1098
1659
|
};
|
|
1099
1660
|
},
|
|
1100
1661
|
{ isolationLevel: "repeatable read", accessMode: "read only" },
|
|
@@ -1109,6 +1670,15 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
1109
1670
|
const violations: string[] = [];
|
|
1110
1671
|
const identity = posture.identity;
|
|
1111
1672
|
|
|
1673
|
+
if (
|
|
1674
|
+
posture.sessionTenancyProductActivationPresent &&
|
|
1675
|
+
options.organizationTenancyCanonicalActivationEnabled !== true
|
|
1676
|
+
) {
|
|
1677
|
+
violations.push(
|
|
1678
|
+
"session-tenancy product activation is durable but OPENGENI_ORGANIZATION_TENANCY_CANONICAL_ACTIVATION_ENABLED is not true",
|
|
1679
|
+
);
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1112
1682
|
if (!identity.currentUser || !identity.sessionUser) {
|
|
1113
1683
|
violations.push("database identity is empty");
|
|
1114
1684
|
}
|
|
@@ -1264,6 +1834,33 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
1264
1834
|
}
|
|
1265
1835
|
|
|
1266
1836
|
const targetSchemaOwner = posture.schemas.find((schema) => schema.name === targetSchema)?.owner;
|
|
1837
|
+
for (const forbiddenRoutine of RUNTIME_TARGET_SCHEMA_FORBIDDEN_ROUTINES) {
|
|
1838
|
+
const matches = posture.targetRoutines.filter((routine) => routine.name === forbiddenRoutine);
|
|
1839
|
+
if (matches.length !== 1) {
|
|
1840
|
+
violations.push(
|
|
1841
|
+
`owner-internal target-schema helper ${forbiddenRoutine} is missing or ambiguous`,
|
|
1842
|
+
);
|
|
1843
|
+
continue;
|
|
1844
|
+
}
|
|
1845
|
+
const routine = matches[0]!;
|
|
1846
|
+
if (!routine.securityDefiner) {
|
|
1847
|
+
violations.push(
|
|
1848
|
+
`owner-internal target-schema helper ${routine.name} is not SECURITY DEFINER`,
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
const authorityOwner = tableByName.get("sessions")?.owner ?? targetSchemaOwner;
|
|
1852
|
+
if (authorityOwner && routine.owner !== authorityOwner) {
|
|
1853
|
+
violations.push(
|
|
1854
|
+
`owner-internal target-schema helper ${routine.name} owner ${routine.owner} does not match session authority owner ${authorityOwner}`,
|
|
1855
|
+
);
|
|
1856
|
+
}
|
|
1857
|
+
if (routine.execute) {
|
|
1858
|
+
violations.push(`runtime role has forbidden owner-internal helper ${routine.name}`);
|
|
1859
|
+
}
|
|
1860
|
+
if (routine.publicExecute) {
|
|
1861
|
+
violations.push(`PUBLIC has forbidden owner-internal helper ${routine.name}`);
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1267
1864
|
for (const expectedRoutine of RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES) {
|
|
1268
1865
|
const matches = posture.targetRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
1269
1866
|
if (matches.length !== 1) {
|
|
@@ -1345,47 +1942,65 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
1345
1942
|
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0].owner}`,
|
|
1346
1943
|
);
|
|
1347
1944
|
}
|
|
1348
|
-
} else if (
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
);
|
|
1357
|
-
} else if (authorityOwners.size !== 1) {
|
|
1945
|
+
} else if (routine.name === GOVERNED_LEARNING_EVALUATION_ROUTINE) {
|
|
1946
|
+
if (!tableByName.has("governed_learning_decision_receipts")) {
|
|
1947
|
+
continue;
|
|
1948
|
+
}
|
|
1949
|
+
const missingAuthorityTables = GOVERNED_LEARNING_EVALUATION_AUTHORITY_TABLES.filter(
|
|
1950
|
+
(tableName) => !tableByName.has(tableName),
|
|
1951
|
+
);
|
|
1952
|
+
if (missingAuthorityTables.length > 0) {
|
|
1358
1953
|
violations.push(
|
|
1359
|
-
`target-schema runtime capability ${routine.name} authority
|
|
1954
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
1360
1955
|
);
|
|
1361
|
-
} else
|
|
1362
|
-
|
|
1363
|
-
|
|
1956
|
+
} else {
|
|
1957
|
+
const authorityTables = GOVERNED_LEARNING_EVALUATION_AUTHORITY_TABLES.map(
|
|
1958
|
+
(tableName) => tableByName.get(tableName)!,
|
|
1364
1959
|
);
|
|
1960
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
1961
|
+
if (authorityOwners.size !== 1) {
|
|
1962
|
+
violations.push(
|
|
1963
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
1964
|
+
);
|
|
1965
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
1966
|
+
violations.push(
|
|
1967
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1365
1970
|
}
|
|
1366
|
-
} else if (
|
|
1367
|
-
|
|
1368
|
-
|
|
1971
|
+
} else if (
|
|
1972
|
+
GOVERNED_LEARNING_INSPECTION_ROUTINES.includes(
|
|
1973
|
+
routine.name as (typeof GOVERNED_LEARNING_INSPECTION_ROUTINES)[number],
|
|
1974
|
+
)
|
|
1975
|
+
) {
|
|
1976
|
+
if (!tableByName.has("governed_learning_decision_receipts")) continue;
|
|
1977
|
+
const missingAuthorityTables = GOVERNED_LEARNING_INSPECTION_AUTHORITY_TABLES.filter(
|
|
1978
|
+
(name) => !tableByName.has(name),
|
|
1979
|
+
);
|
|
1980
|
+
if (missingAuthorityTables.length > 0) {
|
|
1369
1981
|
violations.push(
|
|
1370
|
-
`target-schema runtime capability ${routine.name}
|
|
1982
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
1983
|
+
);
|
|
1984
|
+
} else {
|
|
1985
|
+
const authorityTables = GOVERNED_LEARNING_INSPECTION_AUTHORITY_TABLES.map(
|
|
1986
|
+
(name) => tableByName.get(name)!,
|
|
1371
1987
|
);
|
|
1988
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
1989
|
+
if (authorityOwners.size !== 1 || routine.owner !== authorityTables[0]!.owner) {
|
|
1990
|
+
violations.push(
|
|
1991
|
+
`target-schema runtime capability ${routine.name} owner does not match governed-learning inspection authority`,
|
|
1992
|
+
);
|
|
1993
|
+
}
|
|
1372
1994
|
}
|
|
1373
|
-
} else if (routine.name === XAI_SNAPSHOT_VALIDATOR_ROUTINE) {
|
|
1374
|
-
// The immutable SQL validator is invoker-rights and reads no table. Its
|
|
1375
|
-
// exact ACL is posture-checked above; it does not participate in the
|
|
1376
|
-
// SECURITY DEFINER same-owner authority graph.
|
|
1377
1995
|
} else if (
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
routine.name === XAI_POOL_VISIBLE_ROUTINE ||
|
|
1382
|
-
routine.name === XAI_RESOLVE_POOL_ROUTINE ||
|
|
1383
|
-
routine.name === XAI_REVALIDATE_CREDENTIAL_ROUTINE
|
|
1996
|
+
GOVERNED_LEARNING_ACTIVATION_ROUTINES.includes(
|
|
1997
|
+
routine.name as (typeof GOVERNED_LEARNING_ACTIVATION_ROUTINES)[number],
|
|
1998
|
+
)
|
|
1384
1999
|
) {
|
|
1385
|
-
if (!tableByName.has("
|
|
2000
|
+
if (!tableByName.has("governed_learning_activation_receipts")) {
|
|
1386
2001
|
continue;
|
|
1387
2002
|
}
|
|
1388
|
-
const missingAuthorityTables =
|
|
2003
|
+
const missingAuthorityTables = GOVERNED_LEARNING_ACTIVATION_AUTHORITY_TABLES.filter(
|
|
1389
2004
|
(tableName) => !tableByName.has(tableName),
|
|
1390
2005
|
);
|
|
1391
2006
|
if (missingAuthorityTables.length > 0) {
|
|
@@ -1393,7 +2008,7 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
1393
2008
|
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
1394
2009
|
);
|
|
1395
2010
|
} else {
|
|
1396
|
-
const authorityTables =
|
|
2011
|
+
const authorityTables = GOVERNED_LEARNING_ACTIVATION_AUTHORITY_TABLES.map(
|
|
1397
2012
|
(tableName) => tableByName.get(tableName)!,
|
|
1398
2013
|
);
|
|
1399
2014
|
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
@@ -1407,39 +2022,272 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
1407
2022
|
);
|
|
1408
2023
|
}
|
|
1409
2024
|
}
|
|
1410
|
-
} else if (
|
|
1411
|
-
|
|
1412
|
-
|
|
2025
|
+
} else if (
|
|
2026
|
+
COMPANY_PROFILE_AGENT_ADMIN_ROUTINES.includes(
|
|
2027
|
+
routine.name as (typeof COMPANY_PROFILE_AGENT_ADMIN_ROUTINES)[number],
|
|
2028
|
+
)
|
|
2029
|
+
) {
|
|
2030
|
+
const missingAuthorityTables = COMPANY_PROFILE_AGENT_ADMIN_AUTHORITY_TABLES.filter(
|
|
2031
|
+
(tableName) => !tableByName.has(tableName),
|
|
1413
2032
|
);
|
|
1414
|
-
|
|
1415
|
-
if (!routine.execute) {
|
|
1416
|
-
violations.push(`runtime role lacks target-schema capability ${routine.name}`);
|
|
1417
|
-
}
|
|
1418
|
-
if (routine.publicExecute) {
|
|
1419
|
-
violations.push(`PUBLIC has forbidden target-schema capability ${routine.name}`);
|
|
1420
|
-
}
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
const artifactOutbox = tableByName.get("editable_artifact_live_outbox");
|
|
1424
|
-
if (artifactOutbox) {
|
|
1425
|
-
if (!artifactOutbox.artifactOutboxDispatcherPolicy) {
|
|
1426
|
-
violations.push("table editable_artifact_live_outbox lacks its owner dispatcher RLS policy");
|
|
1427
|
-
}
|
|
1428
|
-
for (const expectedRoutine of ARTIFACT_OUTBOX_CAPABILITY_ROUTINES) {
|
|
1429
|
-
const matches = posture.privateRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
1430
|
-
if (matches.length !== 1) {
|
|
1431
|
-
violations.push(`artifact outbox capability ${expectedRoutine} is missing or ambiguous`);
|
|
1432
|
-
continue;
|
|
1433
|
-
}
|
|
1434
|
-
const routine = matches[0]!;
|
|
1435
|
-
if (!routine.securityDefiner) {
|
|
1436
|
-
violations.push(`artifact outbox capability ${routine.name} is not SECURITY DEFINER`);
|
|
1437
|
-
}
|
|
1438
|
-
if (routine.owner !== artifactOutbox.owner) {
|
|
2033
|
+
if (missingAuthorityTables.length > 0) {
|
|
1439
2034
|
violations.push(
|
|
1440
|
-
`
|
|
2035
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
1441
2036
|
);
|
|
1442
|
-
}
|
|
2037
|
+
} else {
|
|
2038
|
+
const authorityTables = COMPANY_PROFILE_AGENT_ADMIN_AUTHORITY_TABLES.map(
|
|
2039
|
+
(tableName) => tableByName.get(tableName)!,
|
|
2040
|
+
);
|
|
2041
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2042
|
+
if (authorityOwners.size !== 1) {
|
|
2043
|
+
violations.push(
|
|
2044
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
2045
|
+
);
|
|
2046
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
2047
|
+
violations.push(
|
|
2048
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
} else if (
|
|
2053
|
+
(ORGANIZATION_MEMBERSHIP_LIFECYCLE_ROUTINES as readonly string[]).includes(routine.name)
|
|
2054
|
+
) {
|
|
2055
|
+
const missingAuthorityTables = ORGANIZATION_MEMBERSHIP_LIFECYCLE_AUTHORITY_TABLES.filter(
|
|
2056
|
+
(tableName) => !tableByName.has(tableName),
|
|
2057
|
+
);
|
|
2058
|
+
if (missingAuthorityTables.length > 0) {
|
|
2059
|
+
violations.push(
|
|
2060
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
2061
|
+
);
|
|
2062
|
+
} else {
|
|
2063
|
+
const authorityTables = ORGANIZATION_MEMBERSHIP_LIFECYCLE_AUTHORITY_TABLES.map(
|
|
2064
|
+
(tableName) => tableByName.get(tableName)!,
|
|
2065
|
+
);
|
|
2066
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2067
|
+
if (authorityOwners.size !== 1) {
|
|
2068
|
+
violations.push(
|
|
2069
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
2070
|
+
);
|
|
2071
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
2072
|
+
violations.push(
|
|
2073
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
2074
|
+
);
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
} else if (
|
|
2078
|
+
(ORGANIZATION_PRIVATE_SESSION_ROUTINES as readonly string[]).includes(routine.name)
|
|
2079
|
+
) {
|
|
2080
|
+
if (!tableByName.has("organization_private_session_settings")) {
|
|
2081
|
+
continue;
|
|
2082
|
+
}
|
|
2083
|
+
const authorityTableNames =
|
|
2084
|
+
ORGANIZATION_PRIVATE_SESSION_ROUTINE_AUTHORITY_TABLES[
|
|
2085
|
+
routine.name as keyof typeof ORGANIZATION_PRIVATE_SESSION_ROUTINE_AUTHORITY_TABLES
|
|
2086
|
+
];
|
|
2087
|
+
const missingAuthorityTables = authorityTableNames.filter(
|
|
2088
|
+
(tableName) => !tableByName.has(tableName),
|
|
2089
|
+
);
|
|
2090
|
+
if (missingAuthorityTables.length > 0) {
|
|
2091
|
+
violations.push(
|
|
2092
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
2093
|
+
);
|
|
2094
|
+
} else {
|
|
2095
|
+
const authorityTables = authorityTableNames.map((tableName) => tableByName.get(tableName)!);
|
|
2096
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2097
|
+
if (authorityOwners.size !== 1) {
|
|
2098
|
+
violations.push(
|
|
2099
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
2100
|
+
);
|
|
2101
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
2102
|
+
violations.push(
|
|
2103
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
2104
|
+
);
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
} else if (routine.name === PREFERENCE_KNOWLEDGE_PROPOSAL_ROUTINE) {
|
|
2108
|
+
if (!tableByName.has("company_brain_preference_proposal_receipts")) {
|
|
2109
|
+
continue;
|
|
2110
|
+
}
|
|
2111
|
+
const missingAuthorityTables = PREFERENCE_KNOWLEDGE_PROPOSAL_AUTHORITY_TABLES.filter(
|
|
2112
|
+
(tableName) => !tableByName.has(tableName),
|
|
2113
|
+
);
|
|
2114
|
+
if (missingAuthorityTables.length > 0) {
|
|
2115
|
+
violations.push(
|
|
2116
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
2117
|
+
);
|
|
2118
|
+
} else {
|
|
2119
|
+
const authorityTables = PREFERENCE_KNOWLEDGE_PROPOSAL_AUTHORITY_TABLES.map(
|
|
2120
|
+
(tableName) => tableByName.get(tableName)!,
|
|
2121
|
+
);
|
|
2122
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2123
|
+
if (authorityOwners.size !== 1) {
|
|
2124
|
+
violations.push(
|
|
2125
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
2126
|
+
);
|
|
2127
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
2128
|
+
violations.push(
|
|
2129
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
2130
|
+
);
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
} else if ((CANONICAL_HUMAN_IDENTITY_ROUTINES as readonly string[]).includes(routine.name)) {
|
|
2134
|
+
const authorityTables = CANONICAL_HUMAN_IDENTITY_AUTHORITY_TABLES.filter((tableName) =>
|
|
2135
|
+
tableByName.has(tableName),
|
|
2136
|
+
).map((tableName) => tableByName.get(tableName)!);
|
|
2137
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2138
|
+
if (authorityTables.length !== CANONICAL_HUMAN_IDENTITY_AUTHORITY_TABLES.length) {
|
|
2139
|
+
violations.push(
|
|
2140
|
+
`target-schema runtime capability ${routine.name} canonical identity authority tables are missing`,
|
|
2141
|
+
);
|
|
2142
|
+
} else if (authorityOwners.size !== 1) {
|
|
2143
|
+
violations.push(
|
|
2144
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
2145
|
+
);
|
|
2146
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
2147
|
+
violations.push(
|
|
2148
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
2149
|
+
);
|
|
2150
|
+
}
|
|
2151
|
+
} else if (
|
|
2152
|
+
(PERSONAL_GITHUB_REPOSITORY_AUTHORITY_ROUTINES as readonly string[]).includes(routine.name)
|
|
2153
|
+
) {
|
|
2154
|
+
const authorityTables = PERSONAL_GITHUB_REPOSITORY_AUTHORITY_TABLES.map((tableName) =>
|
|
2155
|
+
tableByName.get(tableName),
|
|
2156
|
+
).filter((table): table is RuntimeTablePosture => table !== undefined);
|
|
2157
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2158
|
+
if (authorityOwners.size > 1) {
|
|
2159
|
+
violations.push(
|
|
2160
|
+
`target-schema runtime capability ${routine.name} personal GitHub repository authority table owners do not match`,
|
|
2161
|
+
);
|
|
2162
|
+
} else {
|
|
2163
|
+
const authorityOwner = authorityTables[0]?.owner ?? targetSchemaOwner;
|
|
2164
|
+
if (authorityOwner && routine.owner !== authorityOwner) {
|
|
2165
|
+
violations.push(
|
|
2166
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match personal GitHub repository authority owner ${authorityOwner}`,
|
|
2167
|
+
);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2170
|
+
} else if (
|
|
2171
|
+
(PERSONAL_DOCUMENT_AUTHORITY_ROUTINES as readonly string[]).includes(routine.name) ||
|
|
2172
|
+
(DOCUMENT_MIGRATION_AUTHORITY_ROUTINES as readonly string[]).includes(routine.name)
|
|
2173
|
+
) {
|
|
2174
|
+
const authorityOwner = tableByName.get("documents")?.owner ?? targetSchemaOwner;
|
|
2175
|
+
if (authorityOwner && routine.owner !== authorityOwner) {
|
|
2176
|
+
violations.push(
|
|
2177
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match document authority owner ${authorityOwner}`,
|
|
2178
|
+
);
|
|
2179
|
+
}
|
|
2180
|
+
} else if ((VARIABLE_SET_AUTHORITY_ROUTINES as readonly string[]).includes(routine.name)) {
|
|
2181
|
+
const authorityTables = ["workspace_variable_sets", "workspace_variable_set_variables"]
|
|
2182
|
+
.map((tableName) => tableByName.get(tableName))
|
|
2183
|
+
.filter((table): table is RuntimeTablePosture => table !== undefined);
|
|
2184
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2185
|
+
if (authorityOwners.size > 1) {
|
|
2186
|
+
violations.push(
|
|
2187
|
+
`target-schema runtime capability ${routine.name} variable-set table owners do not match`,
|
|
2188
|
+
);
|
|
2189
|
+
} else {
|
|
2190
|
+
const authorityOwner = authorityTables[0]?.owner ?? targetSchemaOwner;
|
|
2191
|
+
if (authorityOwner && routine.owner !== authorityOwner) {
|
|
2192
|
+
violations.push(
|
|
2193
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match variable-set authority owner ${authorityOwner}`,
|
|
2194
|
+
);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
} else if ((SCOPED_COMPUTE_AUTHORITY_ROUTINES as readonly string[]).includes(routine.name)) {
|
|
2198
|
+
const authorityTables = ["rigs", "rig_versions", "enrollments", "sandboxes"]
|
|
2199
|
+
.map((tableName) => tableByName.get(tableName))
|
|
2200
|
+
.filter((table): table is RuntimeTablePosture => table !== undefined);
|
|
2201
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2202
|
+
if (authorityOwners.size > 1) {
|
|
2203
|
+
violations.push(
|
|
2204
|
+
`target-schema runtime capability ${routine.name} scoped-compute table owners do not match`,
|
|
2205
|
+
);
|
|
2206
|
+
} else {
|
|
2207
|
+
const authorityOwner = authorityTables[0]?.owner ?? targetSchemaOwner;
|
|
2208
|
+
if (authorityOwner && routine.owner !== authorityOwner) {
|
|
2209
|
+
violations.push(
|
|
2210
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match scoped-compute authority owner ${authorityOwner}`,
|
|
2211
|
+
);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
} else if (SESSION_AUTHORITY_ROUTINES.has(routine.name)) {
|
|
2215
|
+
const authorityOwner = tableByName.get("sessions")?.owner ?? targetSchemaOwner;
|
|
2216
|
+
if (authorityOwner && routine.owner !== authorityOwner) {
|
|
2217
|
+
violations.push(
|
|
2218
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match session authority owner ${authorityOwner}`,
|
|
2219
|
+
);
|
|
2220
|
+
}
|
|
2221
|
+
} else if (routine.name === XAI_SNAPSHOT_VALIDATOR_ROUTINE) {
|
|
2222
|
+
// The immutable SQL validator is invoker-rights and reads no table. Its
|
|
2223
|
+
// exact ACL is posture-checked above; it does not participate in the
|
|
2224
|
+
// SECURITY DEFINER same-owner authority graph.
|
|
2225
|
+
} else if (
|
|
2226
|
+
routine.name === XAI_CREATE_CREDENTIAL_ROUTINE ||
|
|
2227
|
+
routine.name === XAI_DISCONNECT_CREDENTIAL_ROUTINE ||
|
|
2228
|
+
routine.name === XAI_AUTHORITY_LIVE_ROUTINE ||
|
|
2229
|
+
routine.name === XAI_POOL_VISIBLE_ROUTINE ||
|
|
2230
|
+
routine.name === XAI_RESOLVE_POOL_ROUTINE ||
|
|
2231
|
+
routine.name === XAI_REVALIDATE_CREDENTIAL_ROUTINE
|
|
2232
|
+
) {
|
|
2233
|
+
if (!tableByName.has("xai_subscription_credentials")) {
|
|
2234
|
+
continue;
|
|
2235
|
+
}
|
|
2236
|
+
const missingAuthorityTables = XAI_AUTHORITY_TABLES.filter(
|
|
2237
|
+
(tableName) => !tableByName.has(tableName),
|
|
2238
|
+
);
|
|
2239
|
+
if (missingAuthorityTables.length > 0) {
|
|
2240
|
+
violations.push(
|
|
2241
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
2242
|
+
);
|
|
2243
|
+
} else {
|
|
2244
|
+
const authorityTables = XAI_AUTHORITY_TABLES.map(
|
|
2245
|
+
(tableName) => tableByName.get(tableName)!,
|
|
2246
|
+
);
|
|
2247
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
2248
|
+
if (authorityOwners.size !== 1) {
|
|
2249
|
+
violations.push(
|
|
2250
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
2251
|
+
);
|
|
2252
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
2253
|
+
violations.push(
|
|
2254
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
} else if (targetSchemaOwner && routine.owner !== targetSchemaOwner) {
|
|
2259
|
+
violations.push(
|
|
2260
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match schema owner ${targetSchemaOwner}`,
|
|
2261
|
+
);
|
|
2262
|
+
}
|
|
2263
|
+
if (!routine.execute) {
|
|
2264
|
+
violations.push(`runtime role lacks target-schema capability ${routine.name}`);
|
|
2265
|
+
}
|
|
2266
|
+
if (routine.publicExecute) {
|
|
2267
|
+
violations.push(`PUBLIC has forbidden target-schema capability ${routine.name}`);
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
const artifactOutbox = tableByName.get("editable_artifact_live_outbox");
|
|
2272
|
+
if (artifactOutbox) {
|
|
2273
|
+
if (!artifactOutbox.artifactOutboxDispatcherPolicy) {
|
|
2274
|
+
violations.push("table editable_artifact_live_outbox lacks its owner dispatcher RLS policy");
|
|
2275
|
+
}
|
|
2276
|
+
for (const expectedRoutine of ARTIFACT_OUTBOX_CAPABILITY_ROUTINES) {
|
|
2277
|
+
const matches = posture.privateRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
2278
|
+
if (matches.length !== 1) {
|
|
2279
|
+
violations.push(`artifact outbox capability ${expectedRoutine} is missing or ambiguous`);
|
|
2280
|
+
continue;
|
|
2281
|
+
}
|
|
2282
|
+
const routine = matches[0]!;
|
|
2283
|
+
if (!routine.securityDefiner) {
|
|
2284
|
+
violations.push(`artifact outbox capability ${routine.name} is not SECURITY DEFINER`);
|
|
2285
|
+
}
|
|
2286
|
+
if (routine.owner !== artifactOutbox.owner) {
|
|
2287
|
+
violations.push(
|
|
2288
|
+
`artifact outbox capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactOutbox.owner}`,
|
|
2289
|
+
);
|
|
2290
|
+
}
|
|
1443
2291
|
if (routine.execute) {
|
|
1444
2292
|
violations.push(
|
|
1445
2293
|
`generic runtime role has forbidden global artifact outbox capability ${routine.name}`,
|
|
@@ -1586,9 +2434,376 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
1586
2434
|
}
|
|
1587
2435
|
}
|
|
1588
2436
|
|
|
2437
|
+
const personalResourceCapabilityTables = posture.privateTables.filter(
|
|
2438
|
+
(table) => table.name === PERSONAL_RESOURCE_CAPABILITY_TABLE,
|
|
2439
|
+
);
|
|
2440
|
+
const personalResourceCapabilityRoutines = posture.privateRoutines.filter(
|
|
2441
|
+
(routine) => routine.name === PERSONAL_RESOURCE_CAPABILITY_PREDICATE_ROUTINE,
|
|
2442
|
+
);
|
|
2443
|
+
if (personalResourceCapabilityTables.length !== 1) {
|
|
2444
|
+
violations.push(
|
|
2445
|
+
`personal-resource capability table ${PERSONAL_RESOURCE_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2446
|
+
);
|
|
2447
|
+
}
|
|
2448
|
+
if (personalResourceCapabilityRoutines.length !== 1) {
|
|
2449
|
+
violations.push(
|
|
2450
|
+
`personal-resource capability predicate ${PERSONAL_RESOURCE_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2451
|
+
);
|
|
2452
|
+
}
|
|
2453
|
+
if (
|
|
2454
|
+
personalResourceCapabilityTables.length === 1 &&
|
|
2455
|
+
personalResourceCapabilityRoutines.length === 1
|
|
2456
|
+
) {
|
|
2457
|
+
const table = personalResourceCapabilityTables[0]!;
|
|
2458
|
+
const routine = personalResourceCapabilityRoutines[0]!;
|
|
2459
|
+
if (routine.owner !== table.owner) {
|
|
2460
|
+
violations.push(
|
|
2461
|
+
`personal-resource capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
if (!routine.securityDefiner) {
|
|
2465
|
+
violations.push(
|
|
2466
|
+
`personal-resource capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2467
|
+
);
|
|
2468
|
+
}
|
|
2469
|
+
if (!routine.execute) {
|
|
2470
|
+
violations.push(`runtime role lacks personal-resource capability predicate ${routine.name}`);
|
|
2471
|
+
}
|
|
2472
|
+
if (routine.publicExecute) {
|
|
2473
|
+
violations.push(
|
|
2474
|
+
`PUBLIC has forbidden personal-resource capability predicate ${routine.name}`,
|
|
2475
|
+
);
|
|
2476
|
+
}
|
|
2477
|
+
const directPrivileges = [
|
|
2478
|
+
["SELECT", table.select],
|
|
2479
|
+
["INSERT", table.insert],
|
|
2480
|
+
["UPDATE", table.update],
|
|
2481
|
+
["DELETE", table.delete],
|
|
2482
|
+
].filter(([, granted]) => granted);
|
|
2483
|
+
if (directPrivileges.length > 0) {
|
|
2484
|
+
violations.push(
|
|
2485
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2486
|
+
);
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
const personalDocumentCapabilityTables = posture.privateTables.filter(
|
|
2491
|
+
(table) => table.name === PERSONAL_DOCUMENT_CAPABILITY_TABLE,
|
|
2492
|
+
);
|
|
2493
|
+
const personalDocumentCapabilityRoutines = posture.privateRoutines.filter(
|
|
2494
|
+
(routine) => routine.name === PERSONAL_DOCUMENT_CAPABILITY_PREDICATE_ROUTINE,
|
|
2495
|
+
);
|
|
2496
|
+
if (personalDocumentCapabilityTables.length !== 1) {
|
|
2497
|
+
violations.push(
|
|
2498
|
+
`personal-document capability table ${PERSONAL_DOCUMENT_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2499
|
+
);
|
|
2500
|
+
}
|
|
2501
|
+
if (personalDocumentCapabilityRoutines.length !== 1) {
|
|
2502
|
+
violations.push(
|
|
2503
|
+
`personal-document capability predicate ${PERSONAL_DOCUMENT_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2504
|
+
);
|
|
2505
|
+
}
|
|
2506
|
+
if (
|
|
2507
|
+
personalDocumentCapabilityTables.length === 1 &&
|
|
2508
|
+
personalDocumentCapabilityRoutines.length === 1
|
|
2509
|
+
) {
|
|
2510
|
+
const table = personalDocumentCapabilityTables[0]!;
|
|
2511
|
+
const routine = personalDocumentCapabilityRoutines[0]!;
|
|
2512
|
+
if (routine.owner !== table.owner) {
|
|
2513
|
+
violations.push(
|
|
2514
|
+
`personal-document capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
if (!routine.securityDefiner) {
|
|
2518
|
+
violations.push(
|
|
2519
|
+
`personal-document capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2520
|
+
);
|
|
2521
|
+
}
|
|
2522
|
+
if (!routine.execute) {
|
|
2523
|
+
violations.push(`runtime role lacks personal-document capability predicate ${routine.name}`);
|
|
2524
|
+
}
|
|
2525
|
+
if (routine.publicExecute) {
|
|
2526
|
+
violations.push(
|
|
2527
|
+
`PUBLIC has forbidden personal-document capability predicate ${routine.name}`,
|
|
2528
|
+
);
|
|
2529
|
+
}
|
|
2530
|
+
const directPrivileges = [
|
|
2531
|
+
["SELECT", table.select],
|
|
2532
|
+
["INSERT", table.insert],
|
|
2533
|
+
["UPDATE", table.update],
|
|
2534
|
+
["DELETE", table.delete],
|
|
2535
|
+
].filter(([, granted]) => granted);
|
|
2536
|
+
if (directPrivileges.length > 0) {
|
|
2537
|
+
violations.push(
|
|
2538
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2539
|
+
);
|
|
2540
|
+
}
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
const documentMigrationCapabilityTables = posture.privateTables.filter(
|
|
2544
|
+
(table) => table.name === DOCUMENT_MIGRATION_CAPABILITY_TABLE,
|
|
2545
|
+
);
|
|
2546
|
+
const documentMigrationCapabilityRoutines = posture.privateRoutines.filter(
|
|
2547
|
+
(routine) => routine.name === DOCUMENT_MIGRATION_CAPABILITY_PREDICATE_ROUTINE,
|
|
2548
|
+
);
|
|
2549
|
+
if (documentMigrationCapabilityTables.length !== 1) {
|
|
2550
|
+
violations.push(
|
|
2551
|
+
`document-migration capability table ${DOCUMENT_MIGRATION_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2552
|
+
);
|
|
2553
|
+
}
|
|
2554
|
+
if (documentMigrationCapabilityRoutines.length !== 1) {
|
|
2555
|
+
violations.push(
|
|
2556
|
+
`document-migration capability predicate ${DOCUMENT_MIGRATION_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2557
|
+
);
|
|
2558
|
+
}
|
|
2559
|
+
if (
|
|
2560
|
+
documentMigrationCapabilityTables.length === 1 &&
|
|
2561
|
+
documentMigrationCapabilityRoutines.length === 1
|
|
2562
|
+
) {
|
|
2563
|
+
const table = documentMigrationCapabilityTables[0]!;
|
|
2564
|
+
const routine = documentMigrationCapabilityRoutines[0]!;
|
|
2565
|
+
if (routine.owner !== table.owner) {
|
|
2566
|
+
violations.push(
|
|
2567
|
+
`document-migration capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2568
|
+
);
|
|
2569
|
+
}
|
|
2570
|
+
if (!routine.securityDefiner) {
|
|
2571
|
+
violations.push(
|
|
2572
|
+
`document-migration capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2573
|
+
);
|
|
2574
|
+
}
|
|
2575
|
+
if (!routine.execute) {
|
|
2576
|
+
violations.push(`runtime role lacks document-migration capability predicate ${routine.name}`);
|
|
2577
|
+
}
|
|
2578
|
+
if (routine.publicExecute) {
|
|
2579
|
+
violations.push(
|
|
2580
|
+
`PUBLIC has forbidden document-migration capability predicate ${routine.name}`,
|
|
2581
|
+
);
|
|
2582
|
+
}
|
|
2583
|
+
const directPrivileges = [
|
|
2584
|
+
["SELECT", table.select],
|
|
2585
|
+
["INSERT", table.insert],
|
|
2586
|
+
["UPDATE", table.update],
|
|
2587
|
+
["DELETE", table.delete],
|
|
2588
|
+
].filter(([, granted]) => granted);
|
|
2589
|
+
if (directPrivileges.length > 0) {
|
|
2590
|
+
violations.push(
|
|
2591
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2592
|
+
);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
const scheduledCapabilityTables = posture.privateTables.filter(
|
|
2597
|
+
(table) => table.name === SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_TABLE,
|
|
2598
|
+
);
|
|
2599
|
+
const scheduledCapabilityRoutines = posture.privateRoutines.filter(
|
|
2600
|
+
(routine) => routine.name === SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_PREDICATE_ROUTINE,
|
|
2601
|
+
);
|
|
2602
|
+
if (scheduledCapabilityTables.length !== 1) {
|
|
2603
|
+
violations.push(
|
|
2604
|
+
`scheduled personal-resource capability table ${SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2605
|
+
);
|
|
2606
|
+
}
|
|
2607
|
+
if (scheduledCapabilityRoutines.length !== 1) {
|
|
2608
|
+
violations.push(
|
|
2609
|
+
`scheduled personal-resource capability predicate ${SCHEDULED_PERSONAL_RESOURCE_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2610
|
+
);
|
|
2611
|
+
}
|
|
2612
|
+
if (scheduledCapabilityTables.length === 1 && scheduledCapabilityRoutines.length === 1) {
|
|
2613
|
+
const table = scheduledCapabilityTables[0]!;
|
|
2614
|
+
const routine = scheduledCapabilityRoutines[0]!;
|
|
2615
|
+
if (routine.owner !== table.owner) {
|
|
2616
|
+
violations.push(
|
|
2617
|
+
`scheduled personal-resource capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2618
|
+
);
|
|
2619
|
+
}
|
|
2620
|
+
if (!routine.securityDefiner) {
|
|
2621
|
+
violations.push(
|
|
2622
|
+
`scheduled personal-resource capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2623
|
+
);
|
|
2624
|
+
}
|
|
2625
|
+
if (!routine.execute) {
|
|
2626
|
+
violations.push(
|
|
2627
|
+
`runtime role lacks scheduled personal-resource capability predicate ${routine.name}`,
|
|
2628
|
+
);
|
|
2629
|
+
}
|
|
2630
|
+
if (routine.publicExecute) {
|
|
2631
|
+
violations.push(
|
|
2632
|
+
`PUBLIC has forbidden scheduled personal-resource capability predicate ${routine.name}`,
|
|
2633
|
+
);
|
|
2634
|
+
}
|
|
2635
|
+
const directPrivileges = [
|
|
2636
|
+
["SELECT", table.select],
|
|
2637
|
+
["INSERT", table.insert],
|
|
2638
|
+
["UPDATE", table.update],
|
|
2639
|
+
["DELETE", table.delete],
|
|
2640
|
+
].filter(([, granted]) => granted);
|
|
2641
|
+
if (directPrivileges.length > 0) {
|
|
2642
|
+
violations.push(
|
|
2643
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2644
|
+
);
|
|
2645
|
+
}
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
if (options.protectedTables === undefined) {
|
|
2649
|
+
const variableSetCapabilityTables = posture.privateTables.filter(
|
|
2650
|
+
(table) => table.name === VARIABLE_SET_CAPABILITY_TABLE,
|
|
2651
|
+
);
|
|
2652
|
+
const variableSetCapabilityRoutines = posture.privateRoutines.filter(
|
|
2653
|
+
(routine) => routine.name === VARIABLE_SET_CAPABILITY_PREDICATE_ROUTINE,
|
|
2654
|
+
);
|
|
2655
|
+
if (variableSetCapabilityTables.length !== 1) {
|
|
2656
|
+
violations.push(
|
|
2657
|
+
`variable-set capability table ${VARIABLE_SET_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2658
|
+
);
|
|
2659
|
+
}
|
|
2660
|
+
if (variableSetCapabilityRoutines.length !== 1) {
|
|
2661
|
+
violations.push(
|
|
2662
|
+
`variable-set capability predicate ${VARIABLE_SET_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2663
|
+
);
|
|
2664
|
+
}
|
|
2665
|
+
if (variableSetCapabilityTables.length === 1 && variableSetCapabilityRoutines.length === 1) {
|
|
2666
|
+
const table = variableSetCapabilityTables[0]!;
|
|
2667
|
+
const routine = variableSetCapabilityRoutines[0]!;
|
|
2668
|
+
if (routine.owner !== table.owner) {
|
|
2669
|
+
violations.push(
|
|
2670
|
+
`variable-set capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2671
|
+
);
|
|
2672
|
+
}
|
|
2673
|
+
if (!routine.securityDefiner) {
|
|
2674
|
+
violations.push(
|
|
2675
|
+
`variable-set capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2676
|
+
);
|
|
2677
|
+
}
|
|
2678
|
+
if (!routine.execute) {
|
|
2679
|
+
violations.push(`runtime role lacks variable-set capability predicate ${routine.name}`);
|
|
2680
|
+
}
|
|
2681
|
+
if (routine.publicExecute) {
|
|
2682
|
+
violations.push(`PUBLIC has forbidden variable-set capability predicate ${routine.name}`);
|
|
2683
|
+
}
|
|
2684
|
+
const directPrivileges = [
|
|
2685
|
+
["SELECT", table.select],
|
|
2686
|
+
["INSERT", table.insert],
|
|
2687
|
+
["UPDATE", table.update],
|
|
2688
|
+
["DELETE", table.delete],
|
|
2689
|
+
].filter(([, granted]) => granted);
|
|
2690
|
+
if (directPrivileges.length > 0) {
|
|
2691
|
+
violations.push(
|
|
2692
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2693
|
+
);
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
const scopedComputeCapabilityTables = posture.privateTables.filter(
|
|
2697
|
+
(table) => table.name === SCOPED_COMPUTE_CAPABILITY_TABLE,
|
|
2698
|
+
);
|
|
2699
|
+
const scopedComputeCapabilityRoutines = posture.privateRoutines.filter(
|
|
2700
|
+
(routine) => routine.name === SCOPED_COMPUTE_CAPABILITY_PREDICATE_ROUTINE,
|
|
2701
|
+
);
|
|
2702
|
+
if (scopedComputeCapabilityTables.length !== 1) {
|
|
2703
|
+
violations.push(
|
|
2704
|
+
`scoped-compute capability table ${SCOPED_COMPUTE_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2705
|
+
);
|
|
2706
|
+
}
|
|
2707
|
+
if (scopedComputeCapabilityRoutines.length !== 1) {
|
|
2708
|
+
violations.push(
|
|
2709
|
+
`scoped-compute capability predicate ${SCOPED_COMPUTE_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2710
|
+
);
|
|
2711
|
+
}
|
|
2712
|
+
if (
|
|
2713
|
+
scopedComputeCapabilityTables.length === 1 &&
|
|
2714
|
+
scopedComputeCapabilityRoutines.length === 1
|
|
2715
|
+
) {
|
|
2716
|
+
const table = scopedComputeCapabilityTables[0]!;
|
|
2717
|
+
const routine = scopedComputeCapabilityRoutines[0]!;
|
|
2718
|
+
if (routine.owner !== table.owner) {
|
|
2719
|
+
violations.push(
|
|
2720
|
+
`scoped-compute capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2721
|
+
);
|
|
2722
|
+
}
|
|
2723
|
+
if (!routine.securityDefiner) {
|
|
2724
|
+
violations.push(
|
|
2725
|
+
`scoped-compute capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2726
|
+
);
|
|
2727
|
+
}
|
|
2728
|
+
if (!routine.execute) {
|
|
2729
|
+
violations.push(`runtime role lacks scoped-compute capability predicate ${routine.name}`);
|
|
2730
|
+
}
|
|
2731
|
+
if (routine.publicExecute) {
|
|
2732
|
+
violations.push(`PUBLIC has forbidden scoped-compute capability predicate ${routine.name}`);
|
|
2733
|
+
}
|
|
2734
|
+
const directPrivileges = [
|
|
2735
|
+
["SELECT", table.select],
|
|
2736
|
+
["INSERT", table.insert],
|
|
2737
|
+
["UPDATE", table.update],
|
|
2738
|
+
["DELETE", table.delete],
|
|
2739
|
+
].filter(([, granted]) => granted);
|
|
2740
|
+
if (directPrivileges.length > 0) {
|
|
2741
|
+
violations.push(
|
|
2742
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2743
|
+
);
|
|
2744
|
+
}
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
|
|
1589
2748
|
if (posture.privateRoutines.length === 0) {
|
|
1590
2749
|
violations.push("opengeni_private has no helper routines");
|
|
1591
2750
|
}
|
|
2751
|
+
|
|
2752
|
+
const connectionBackfillCapabilityTables = posture.privateTables.filter(
|
|
2753
|
+
(table) => table.name === CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE,
|
|
2754
|
+
);
|
|
2755
|
+
const connectionBackfillCapabilityRoutines = posture.privateRoutines.filter(
|
|
2756
|
+
(routine) => routine.name === CONNECTION_TENANCY_BACKFILL_CAPABILITY_PREDICATE_ROUTINE,
|
|
2757
|
+
);
|
|
2758
|
+
if (connectionBackfillCapabilityTables.length !== 1) {
|
|
2759
|
+
violations.push(
|
|
2760
|
+
`connection-tenancy backfill capability table ${CONNECTION_TENANCY_BACKFILL_CAPABILITY_TABLE} is missing or ambiguous`,
|
|
2761
|
+
);
|
|
2762
|
+
}
|
|
2763
|
+
if (connectionBackfillCapabilityRoutines.length !== 1) {
|
|
2764
|
+
violations.push(
|
|
2765
|
+
`connection-tenancy backfill capability predicate ${CONNECTION_TENANCY_BACKFILL_CAPABILITY_PREDICATE_ROUTINE} is missing or ambiguous`,
|
|
2766
|
+
);
|
|
2767
|
+
}
|
|
2768
|
+
if (
|
|
2769
|
+
connectionBackfillCapabilityTables.length === 1 &&
|
|
2770
|
+
connectionBackfillCapabilityRoutines.length === 1
|
|
2771
|
+
) {
|
|
2772
|
+
const table = connectionBackfillCapabilityTables[0]!;
|
|
2773
|
+
const routine = connectionBackfillCapabilityRoutines[0]!;
|
|
2774
|
+
if (routine.owner !== table.owner) {
|
|
2775
|
+
violations.push(
|
|
2776
|
+
`connection-tenancy backfill capability predicate ${routine.name} owner ${routine.owner} does not match table owner ${table.owner}`,
|
|
2777
|
+
);
|
|
2778
|
+
}
|
|
2779
|
+
if (!routine.securityDefiner) {
|
|
2780
|
+
violations.push(
|
|
2781
|
+
`connection-tenancy backfill capability predicate ${routine.name} is not SECURITY DEFINER`,
|
|
2782
|
+
);
|
|
2783
|
+
}
|
|
2784
|
+
if (!routine.execute) {
|
|
2785
|
+
violations.push(
|
|
2786
|
+
`runtime role lacks connection-tenancy backfill capability predicate ${routine.name}`,
|
|
2787
|
+
);
|
|
2788
|
+
}
|
|
2789
|
+
if (routine.publicExecute) {
|
|
2790
|
+
violations.push(
|
|
2791
|
+
`PUBLIC has forbidden connection-tenancy backfill capability predicate ${routine.name}`,
|
|
2792
|
+
);
|
|
2793
|
+
}
|
|
2794
|
+
const directPrivileges = [
|
|
2795
|
+
["SELECT", table.select],
|
|
2796
|
+
["INSERT", table.insert],
|
|
2797
|
+
["UPDATE", table.update],
|
|
2798
|
+
["DELETE", table.delete],
|
|
2799
|
+
].filter(([, granted]) => granted);
|
|
2800
|
+
if (directPrivileges.length > 0) {
|
|
2801
|
+
violations.push(
|
|
2802
|
+
`runtime role has forbidden direct privileges on private table ${table.name}: ${directPrivileges.map(([privilege]) => privilege).join(", ")}`,
|
|
2803
|
+
);
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
|
|
1592
2807
|
for (const routine of posture.privateRoutines) {
|
|
1593
2808
|
if (routine.owner === expectedRole) {
|
|
1594
2809
|
violations.push(`runtime role owns private routine ${routine.name}`);
|