@opengeni/db 0.28.1 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attached-browser-devices.d.ts +42 -0
- package/dist/attempt-tool-catalogs.d.ts +16 -0
- package/dist/browser-auth.d.ts +91 -0
- package/dist/browser-identities.d.ts +128 -0
- package/dist/browser-sessions.d.ts +272 -0
- package/dist/browser-state-artifacts.d.ts +17 -0
- package/dist/capability-components.d.ts +37 -0
- package/dist/capability-integrations.d.ts +192 -0
- package/dist/chunk-F5FT7BEZ.js +3535 -0
- package/dist/chunk-F5FT7BEZ.js.map +1 -0
- package/dist/chunk-ISI2TIUG.js +639 -0
- package/dist/chunk-ISI2TIUG.js.map +1 -0
- package/dist/chunk-MWDVXQOL.js +11639 -0
- package/dist/chunk-MWDVXQOL.js.map +1 -0
- package/dist/chunk-NBE6CHRI.js +955 -0
- package/dist/chunk-NBE6CHRI.js.map +1 -0
- package/dist/{chunk-DBS5HPEW.js → chunk-YHZXQ7HP.js} +760 -11
- package/dist/chunk-YHZXQ7HP.js.map +1 -0
- package/dist/codemode-operations.d.ts +117 -0
- package/dist/codex-token-resolver.d.ts +2 -2
- package/dist/company-profile-schema.d.ts +798 -0
- package/dist/company-profile.d.ts +268 -0
- package/dist/computer-sessions.d.ts +109 -0
- package/dist/connection-token-resolver.d.ts +9 -4
- package/dist/database.d.ts +52 -3
- package/dist/editable-artifact-durable-export.d.ts +153 -0
- package/dist/editable-artifact-durable-export.js +788 -0
- package/dist/editable-artifact-durable-export.js.map +1 -0
- package/dist/editable-artifact-materialization.d.ts +123 -0
- package/dist/editable-artifacts-schema.d.ts +4152 -0
- package/dist/editable-artifacts.d.ts +610 -0
- package/dist/editable-artifacts.js +26 -0
- package/dist/editable-artifacts.js.map +1 -0
- package/dist/environment-crypto.d.ts +8 -4
- package/dist/generated-images.d.ts +139 -0
- package/dist/index.d.ts +958 -126
- package/dist/index.js +31204 -12172
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +51 -4
- package/dist/integration-bindings.d.ts +70 -0
- package/dist/integration-features.d.ts +99 -0
- package/dist/interaction-revisions.d.ts +3 -0
- package/dist/interaction-schema.d.ts +5372 -0
- package/dist/knowledge-source-sync-schema.d.ts +1679 -0
- package/dist/knowledge-source-sync.d.ts +274 -0
- package/dist/lossless-columns.d.ts +58 -0
- package/dist/lossless-json.d.ts +39 -0
- package/dist/memory-domain.d.ts +3 -6
- package/dist/memory-governance.d.ts +2 -2
- package/dist/memory-slack-delivery.d.ts +101 -0
- package/dist/new-session-drafts.d.ts +2 -2
- package/dist/pack-components.d.ts +76 -0
- package/dist/pack-installations.d.ts +86 -0
- package/dist/persistence-errors.d.ts +7 -14
- package/dist/plugin-packages.d.ts +126 -0
- package/dist/preference-registry.d.ts +1 -1
- package/dist/provision-roles.d.ts +9 -1
- package/dist/provision-roles.js +1 -1
- package/dist/runtime-posture.d.ts +18 -6
- package/dist/schema.d.ts +19122 -8731
- package/dist/schema.js +173 -1
- package/dist/scoped-knowledge.d.ts +97 -1
- package/dist/session-control.d.ts +4 -4
- package/dist/session-queue-commands.d.ts +19 -11
- package/dist/session-realtime-context.d.ts +2 -2
- package/dist/session-realtime-ledger.d.ts +4 -4
- package/dist/session-realtime-mirror.d.ts +2 -2
- package/dist/session-realtime-state.d.ts +1 -1
- package/dist/session-realtime-terminal.d.ts +8 -1
- package/dist/session-realtime.d.ts +7 -7
- package/dist/session-tool-call-settlement.d.ts +1 -1
- package/dist/slack-user-link-access.d.ts +54 -0
- package/dist/transcription-recordings-schema.d.ts +44 -6
- package/dist/transcription-recordings.d.ts +3 -3
- package/dist/turn-initiator.d.ts +2 -2
- package/dist/video-generation.d.ts +216 -0
- package/dist/video-generation.js +66 -0
- package/dist/video-generation.js.map +1 -0
- package/dist/workspace-artifacts.d.ts +1 -1
- package/dist/workspace-instruction-policies.d.ts +1 -1
- package/dist/workspace-learning-policy-schema.d.ts +932 -0
- package/dist/workspace-learning-policy.d.ts +161 -0
- package/drizzle/0065_enrollment_credential_generation.sql +10 -0
- package/drizzle/0140_retained_screenshot_artifacts.sql +192 -0
- package/drizzle/0176_lossless_canonical_json.sql +975 -0
- package/drizzle/0177_session_events_workspace_turn_type_index.sql +5 -0
- package/drizzle/0178_permissioned_secret_reads.sql +14 -0
- package/drizzle/0179_slack_private_shortcut_delivery_gate.sql +85 -0
- package/drizzle/0180_retained_screenshot_lifecycle_fences.sql +273 -0
- package/drizzle/0181_connected_machine_removal.sql +52 -0
- package/drizzle/0182_connected_machine_remove_session_default.sql +77 -0
- package/drizzle/0183_model_call_provider_cost_estimates.sql +39 -0
- package/drizzle/0184_sandbox_drain_teardown_fence.sql +682 -0
- package/drizzle/0185_temporal_schedule_cleanup_outbox.sql +168 -0
- package/drizzle/0186_sandbox_capture_provider_contract.sql +400 -0
- package/drizzle/0187_generated_image_artifacts.sql +173 -0
- package/drizzle/0188_image_generation_retention_failure.sql +25 -0
- package/drizzle/0189_retained_session_image_formats.sql +13 -0
- package/drizzle/0190_timeline_annotations.sql +31 -0
- package/drizzle/0191_editable_artifact_engine.sql +3853 -0
- package/drizzle/0192_editable_artifact_live_tickets.sql +338 -0
- package/drizzle/0193_editable_artifact_authorization.sql +190 -0
- package/drizzle/0194_editable_artifact_durable_exports.sql +160 -0
- package/drizzle/0195_editable_artifact_import_authorization.sql +203 -0
- package/drizzle/0196_rig_provider_images.sql +152 -0
- package/drizzle/0197_knowledge_source_sync_schedules.sql +523 -0
- package/drizzle/0198_memory_slack_publication_delivery.sql +393 -0
- package/drizzle/0199_workspace_learning_policy.sql +980 -0
- package/drizzle/0201_company_profile_authority.sql +849 -0
- package/drizzle/0202_document_index_checkpoints.sql +85 -0
- package/drizzle/0203_durable_video_generation.sql +353 -0
- package/drizzle/0204_video_generation_funding.sql +44 -0
- package/drizzle/0205_attempt_tool_catalogs.sql +230 -0
- package/drizzle/0206_browser_sessions.sql +646 -0
- package/drizzle/0207_browser_identities.sql +379 -0
- package/drizzle/0208_attached_browser_devices.sql +165 -0
- package/drizzle/0209_computer_sessions.sql +575 -0
- package/drizzle/0210_browser_auth_network_interventions.sql +441 -0
- package/drizzle/0211_editable_artifact_session_links.sql +58 -0
- package/drizzle/0212_slack_installation_bindings.sql +348 -0
- package/drizzle/0213_slack_user_link_access_requests.sql +177 -0
- package/drizzle/0214_session_activity_commit_gate.sql +262 -0
- package/drizzle/0215_capabilities_platform.sql +980 -0
- package/drizzle/0216_pack_component_ownership.sql +235 -0
- package/drizzle/0217_capability_definition_delete_authority.sql +32 -0
- package/package.json +18 -5
- package/src/attached-browser-devices.ts +371 -0
- package/src/attempt-tool-catalogs.ts +131 -0
- package/src/browser-auth.ts +1896 -0
- package/src/browser-identities.ts +1168 -0
- package/src/browser-sessions.ts +2005 -0
- package/src/browser-state-artifacts.ts +59 -0
- package/src/capability-components.ts +166 -0
- package/src/capability-integrations.ts +1663 -0
- package/src/codemode-operations.ts +674 -0
- package/src/company-profile-schema.ts +143 -0
- package/src/company-profile.ts +968 -0
- package/src/computer-sessions.ts +1130 -0
- package/src/connection-token-resolver.ts +270 -25
- package/src/database.ts +434 -24
- package/src/editable-artifact-durable-export.ts +1201 -0
- package/src/editable-artifact-materialization.ts +893 -0
- package/src/editable-artifacts-schema.ts +879 -0
- package/src/editable-artifacts.ts +5404 -0
- package/src/environment-crypto.ts +22 -9
- package/src/generated-images.ts +740 -0
- package/src/index.ts +10117 -2730
- package/src/insights.ts +160 -13
- package/src/integration-bindings.ts +455 -0
- package/src/integration-features.ts +859 -0
- package/src/interaction-revisions.ts +40 -0
- package/src/interaction-schema.ts +1303 -0
- package/src/knowledge-source-sync-schema.ts +192 -0
- package/src/knowledge-source-sync.ts +1922 -0
- package/src/lossless-columns.ts +35 -0
- package/src/lossless-json.ts +322 -0
- package/src/memory-domain.ts +5 -44
- package/src/memory-slack-delivery.ts +801 -0
- package/src/pack-components.ts +954 -0
- package/src/pack-installations.ts +929 -0
- package/src/persistence-errors.ts +26 -34
- package/src/plugin-packages.ts +1186 -0
- package/src/provision-roles.ts +302 -1
- package/src/runtime-posture-cli.ts +9 -0
- package/src/runtime-posture.ts +514 -5
- package/src/schema.ts +5177 -2957
- package/src/scoped-knowledge-schema.ts +1 -1
- package/src/scoped-knowledge.ts +655 -3
- package/src/session-control.ts +133 -81
- package/src/session-queue-commands.ts +511 -247
- package/src/session-realtime-context.ts +20 -7
- package/src/session-realtime-ledger.ts +32 -10
- package/src/session-realtime-mirror.ts +4 -2
- package/src/session-realtime-terminal.ts +89 -21
- package/src/session-realtime.ts +10 -9
- package/src/session-tool-call-settlement.ts +38 -15
- package/src/slack-user-link-access.ts +702 -0
- package/src/transcription-recordings-schema.ts +5 -2
- package/src/transcription-recordings.ts +70 -40
- package/src/video-generation.ts +1452 -0
- package/src/workspace-learning-policy-schema.ts +139 -0
- package/src/workspace-learning-policy.ts +595 -0
- package/dist/chunk-DBS5HPEW.js.map +0 -1
- package/dist/chunk-HT5T62CC.js +0 -6803
- package/dist/chunk-HT5T62CC.js.map +0 -1
- package/dist/event-payload-sanitizer.d.ts +0 -32
- package/src/event-payload-sanitizer.ts +0 -377
|
@@ -89,20 +89,85 @@ function classifyRoleRelationships(rows) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// src/runtime-posture.ts
|
|
92
|
+
var ARTIFACT_OUTBOX_CAPABILITY_ROUTINES = [
|
|
93
|
+
"claim_editable_artifact_live_outbox(text, integer, integer, name)",
|
|
94
|
+
"mark_editable_artifact_live_outbox_published(text, text, integer, name)",
|
|
95
|
+
"renew_editable_artifact_live_outbox(text, text, integer, integer, name)",
|
|
96
|
+
"retry_editable_artifact_live_outbox(text, text, integer, integer, text, name)",
|
|
97
|
+
"dead_letter_editable_artifact_live_outbox(text, text, integer, text, name)",
|
|
98
|
+
"release_editable_artifact_live_outbox(text, text, integer, name)"
|
|
99
|
+
];
|
|
100
|
+
var ARTIFACT_MATERIALIZER_CAPABILITY_ROUTINES = [
|
|
101
|
+
"claim_editable_artifact_materializations(text, integer, integer, name)",
|
|
102
|
+
"renew_editable_artifact_materialization(uuid, uuid, text, text, text, integer, integer, name)",
|
|
103
|
+
"succeed_editable_artifact_materialization(uuid, uuid, text, text, text, integer, text, text, text, bigint, text, text, timestamp with time zone, name)",
|
|
104
|
+
"fail_editable_artifact_materialization(uuid, uuid, text, text, text, integer, text, name)"
|
|
105
|
+
];
|
|
106
|
+
var ARTIFACT_LIVE_TICKET_CAPABILITY_ROUTINES = [
|
|
107
|
+
"put_editable_artifact_live_ticket(text, uuid, uuid, text, text, text, text, text, text, text, text, integer, text, boolean, integer, timestamp with time zone, timestamp with time zone, name)",
|
|
108
|
+
"consume_editable_artifact_live_ticket(text, name)",
|
|
109
|
+
"cleanup_expired_editable_artifact_live_tickets(integer, name)"
|
|
110
|
+
];
|
|
111
|
+
var ARTIFACT_LIVE_TICKET_INTERNAL_ROUTINES = [
|
|
112
|
+
"resolve_editable_artifact_ticket_data_schema(name)"
|
|
113
|
+
];
|
|
114
|
+
var ARTIFACT_AUTHORIZATION_CAPABILITY_ROUTINES = [
|
|
115
|
+
"authorize_editable_artifact_actor(uuid, uuid, text, text, text, text, text, text, integer, text, text, name)"
|
|
116
|
+
];
|
|
117
|
+
var DEDICATED_ARTIFACT_CAPABILITY_ROUTINES = /* @__PURE__ */ new Set([
|
|
118
|
+
...ARTIFACT_OUTBOX_CAPABILITY_ROUTINES,
|
|
119
|
+
...ARTIFACT_MATERIALIZER_CAPABILITY_ROUTINES,
|
|
120
|
+
...ARTIFACT_LIVE_TICKET_INTERNAL_ROUTINES
|
|
121
|
+
]);
|
|
122
|
+
var KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE = "knowledge_source_sync_lock_authority(uuid, uuid, uuid)";
|
|
123
|
+
var KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES = [
|
|
124
|
+
"knowledge_sources",
|
|
125
|
+
"knowledge_source_objects"
|
|
126
|
+
];
|
|
127
|
+
var RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES = [
|
|
128
|
+
KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE
|
|
129
|
+
];
|
|
92
130
|
var FORCE_RLS_TABLES = [
|
|
93
131
|
"agent_run_states",
|
|
94
132
|
"api_keys",
|
|
133
|
+
"attached_browser_devices",
|
|
134
|
+
"attached_browser_inventories",
|
|
95
135
|
"audit_events",
|
|
136
|
+
"auth_runs",
|
|
96
137
|
"billing_customers",
|
|
138
|
+
"browser_identities",
|
|
139
|
+
"browser_revision_components",
|
|
140
|
+
"browser_revisions",
|
|
141
|
+
"browser_session_associations",
|
|
142
|
+
"browser_sessions",
|
|
143
|
+
"browser_state_artifacts",
|
|
144
|
+
"capability_api_facets",
|
|
97
145
|
"capability_catalog_items",
|
|
146
|
+
"capability_component_owners",
|
|
147
|
+
"capability_facet_installations",
|
|
148
|
+
"capability_facets",
|
|
98
149
|
"capability_installations",
|
|
150
|
+
"capability_integration_facets",
|
|
151
|
+
"capability_mcp_facets",
|
|
152
|
+
"capability_operations",
|
|
153
|
+
"capability_plugin_installations",
|
|
154
|
+
"capability_plugin_versions",
|
|
155
|
+
"capability_plugins",
|
|
156
|
+
"capability_skill_facets",
|
|
157
|
+
"capability_skill_files",
|
|
99
158
|
"codex_apps_settings",
|
|
100
159
|
"codex_capacity_waiters",
|
|
101
160
|
"codex_credential_leases",
|
|
102
161
|
"codex_reset_redemption_attempts",
|
|
103
162
|
"codex_rotation_settings",
|
|
104
163
|
"codex_subscription_credentials",
|
|
164
|
+
"company_profile_activation_events",
|
|
165
|
+
"company_profile_heads",
|
|
166
|
+
"company_profile_revisions",
|
|
167
|
+
"company_profile_snapshots",
|
|
105
168
|
"composer_drafts",
|
|
169
|
+
"computer_session_associations",
|
|
170
|
+
"computer_sessions",
|
|
106
171
|
"connection_disconnect_operations",
|
|
107
172
|
"connections",
|
|
108
173
|
"connector_action_policies",
|
|
@@ -112,9 +177,27 @@ var FORCE_RLS_TABLES = [
|
|
|
112
177
|
"document_bases",
|
|
113
178
|
"document_chunks",
|
|
114
179
|
"documents",
|
|
180
|
+
"editable_artifact_blob_refs",
|
|
181
|
+
"editable_artifact_idempotency_receipts",
|
|
182
|
+
"editable_artifact_live_outbox",
|
|
183
|
+
"editable_artifact_live_tickets",
|
|
184
|
+
"editable_artifact_materialization_jobs",
|
|
185
|
+
"editable_artifact_materialization_results",
|
|
186
|
+
"editable_artifact_operations",
|
|
187
|
+
"editable_artifact_replica_leases",
|
|
188
|
+
"editable_artifact_scope_authorization_heads",
|
|
189
|
+
"editable_artifact_sequence_checkpoints",
|
|
190
|
+
"editable_artifact_session_links",
|
|
191
|
+
"editable_artifact_snapshots",
|
|
192
|
+
"editable_artifact_transactions",
|
|
193
|
+
"editable_artifact_undo_claims",
|
|
194
|
+
"editable_artifact_versions",
|
|
195
|
+
"editable_artifacts",
|
|
115
196
|
"enrollments",
|
|
116
197
|
"file_uploads",
|
|
117
198
|
"files",
|
|
199
|
+
"generated_image_artifacts",
|
|
200
|
+
"generated_video_artifacts",
|
|
118
201
|
"github_installation_repositories",
|
|
119
202
|
"github_installations",
|
|
120
203
|
"host_export_config",
|
|
@@ -122,8 +205,17 @@ var FORCE_RLS_TABLES = [
|
|
|
122
205
|
"host_export_cursor_state",
|
|
123
206
|
"host_export_dead_letters",
|
|
124
207
|
"host_export_outbox",
|
|
208
|
+
"image_generation_operations",
|
|
125
209
|
"import_batches",
|
|
210
|
+
"integration_feature_binding_owners",
|
|
211
|
+
"integration_feature_bindings",
|
|
212
|
+
"integration_feature_facets",
|
|
126
213
|
"integration_oauth_state_nonces",
|
|
214
|
+
"integration_spec_revisions",
|
|
215
|
+
"integration_tools",
|
|
216
|
+
"interaction_interventions",
|
|
217
|
+
"interaction_operations",
|
|
218
|
+
"interaction_resource_operations",
|
|
127
219
|
"knowledge_change_proposals",
|
|
128
220
|
"knowledge_claim_evidence",
|
|
129
221
|
"knowledge_claim_relations",
|
|
@@ -141,17 +233,29 @@ var FORCE_RLS_TABLES = [
|
|
|
141
233
|
"knowledge_providers",
|
|
142
234
|
"knowledge_source_acl_versions",
|
|
143
235
|
"knowledge_source_objects",
|
|
236
|
+
"knowledge_source_sync_index_obligations",
|
|
237
|
+
"knowledge_source_sync_item_outcomes",
|
|
238
|
+
"knowledge_source_sync_object_observations",
|
|
239
|
+
"knowledge_source_sync_states",
|
|
240
|
+
"knowledge_source_sync_wakes",
|
|
144
241
|
"knowledge_sources",
|
|
145
242
|
"knowledge_sync_runs",
|
|
146
243
|
"machine_metrics_latest",
|
|
147
244
|
"machine_metrics_series",
|
|
245
|
+
"machine_removal_operations",
|
|
246
|
+
"memory_slack_publication_configurations",
|
|
247
|
+
"memory_slack_publication_receipts",
|
|
248
|
+
"memory_slack_publications",
|
|
148
249
|
"model_call_facts",
|
|
250
|
+
"network_routes",
|
|
149
251
|
"new_session_drafts",
|
|
252
|
+
"pack_installation_components",
|
|
150
253
|
"pack_installations",
|
|
151
254
|
"preference_registry_events",
|
|
152
255
|
"preference_registry_preferences",
|
|
153
256
|
"preference_registry_revisions",
|
|
154
257
|
"preference_registry_snapshots",
|
|
258
|
+
"retained_screenshot_artifacts",
|
|
155
259
|
"rig_changes",
|
|
156
260
|
"rig_versions",
|
|
157
261
|
"rigs",
|
|
@@ -165,7 +269,9 @@ var FORCE_RLS_TABLES = [
|
|
|
165
269
|
"sandboxes",
|
|
166
270
|
"scheduled_task_runs",
|
|
167
271
|
"scheduled_tasks",
|
|
272
|
+
"session_attempt_codemode_calls",
|
|
168
273
|
"session_attempt_interruptions",
|
|
274
|
+
"session_attempt_tool_catalogs",
|
|
169
275
|
"session_command_receipts",
|
|
170
276
|
"session_events",
|
|
171
277
|
"session_goals",
|
|
@@ -188,19 +294,26 @@ var FORCE_RLS_TABLES = [
|
|
|
188
294
|
"session_turns",
|
|
189
295
|
"session_workflow_wake_outbox",
|
|
190
296
|
"sessions",
|
|
297
|
+
"site_auth_connections",
|
|
191
298
|
"slack_bot_delete_operations",
|
|
192
299
|
"slack_bot_post_operations",
|
|
193
300
|
"slack_bot_user_links",
|
|
301
|
+
"slack_installation_bindings",
|
|
194
302
|
"slack_interaction_inbox",
|
|
195
303
|
"slack_interaction_progress_deliveries",
|
|
196
304
|
"slack_interactions",
|
|
305
|
+
"slack_user_link_access_request_operations",
|
|
306
|
+
"slack_user_link_access_requests",
|
|
197
307
|
"social_connections",
|
|
198
308
|
"social_posts",
|
|
309
|
+
"temporal_schedule_cleanup_outbox",
|
|
199
310
|
"transcription_recording_chunks",
|
|
200
311
|
"transcription_recording_objects",
|
|
201
312
|
"transcription_recording_segments",
|
|
202
313
|
"transcription_recordings",
|
|
203
314
|
"usage_events",
|
|
315
|
+
"video_generation_operations",
|
|
316
|
+
"video_generation_references",
|
|
204
317
|
"workspace_artifact_events",
|
|
205
318
|
"workspace_artifact_versions",
|
|
206
319
|
"workspace_artifacts",
|
|
@@ -212,11 +325,19 @@ var FORCE_RLS_TABLES = [
|
|
|
212
325
|
"workspace_instruction_policy_onboarding_proposals",
|
|
213
326
|
"workspace_instruction_policy_revisions",
|
|
214
327
|
"workspace_instruction_policy_snapshots",
|
|
328
|
+
"workspace_interaction_revisions",
|
|
329
|
+
"workspace_learning_policy_activation_events",
|
|
330
|
+
"workspace_learning_policy_heads",
|
|
331
|
+
"workspace_learning_policy_revisions",
|
|
332
|
+
"workspace_learning_policy_snapshots",
|
|
215
333
|
"workspace_model_policies",
|
|
216
334
|
"workspace_packs",
|
|
335
|
+
"workspace_screenshot_quotas",
|
|
217
336
|
"workspace_session_activity_revisions",
|
|
218
337
|
"workspace_variable_set_variables",
|
|
219
|
-
"workspace_variable_sets"
|
|
338
|
+
"workspace_variable_sets",
|
|
339
|
+
"workspace_video_generation_policies",
|
|
340
|
+
"workspace_video_generation_quotas"
|
|
220
341
|
];
|
|
221
342
|
var NON_RLS_RUNTIME_TABLES = [
|
|
222
343
|
"auth_identities",
|
|
@@ -241,8 +362,13 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
241
362
|
"auth_users",
|
|
242
363
|
"auth_verifications",
|
|
243
364
|
"billing_customers",
|
|
365
|
+
"browser_session_associations",
|
|
244
366
|
"capability_catalog_items",
|
|
367
|
+
"capability_component_owners",
|
|
368
|
+
"capability_facet_installations",
|
|
245
369
|
"capability_installations",
|
|
370
|
+
"capability_operations",
|
|
371
|
+
"capability_plugin_installations",
|
|
246
372
|
"codex_apps_settings",
|
|
247
373
|
"codex_capacity_waiters",
|
|
248
374
|
"codex_credential_leases",
|
|
@@ -250,6 +376,7 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
250
376
|
"codex_rotation_settings",
|
|
251
377
|
"codex_subscription_credentials",
|
|
252
378
|
"composer_drafts",
|
|
379
|
+
"computer_session_associations",
|
|
253
380
|
"connection_disconnect_operations",
|
|
254
381
|
"connections",
|
|
255
382
|
"connector_action_policies",
|
|
@@ -259,21 +386,38 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
259
386
|
"document_bases",
|
|
260
387
|
"document_chunks",
|
|
261
388
|
"documents",
|
|
389
|
+
"editable_artifact_replica_leases",
|
|
262
390
|
"enrollments",
|
|
263
391
|
"file_uploads",
|
|
264
392
|
"files",
|
|
393
|
+
"generated_image_artifacts",
|
|
394
|
+
"generated_video_artifacts",
|
|
265
395
|
"github_installation_repositories",
|
|
266
396
|
"github_installations",
|
|
397
|
+
"image_generation_operations",
|
|
267
398
|
"import_batches",
|
|
399
|
+
"integration_feature_binding_owners",
|
|
400
|
+
"integration_feature_bindings",
|
|
268
401
|
"integration_oauth_clients",
|
|
269
402
|
"integration_oauth_state_nonces",
|
|
270
403
|
"knowledge_memories",
|
|
404
|
+
"knowledge_source_sync_index_obligations",
|
|
405
|
+
"knowledge_source_sync_item_outcomes",
|
|
406
|
+
"knowledge_source_sync_object_observations",
|
|
407
|
+
"knowledge_source_sync_states",
|
|
408
|
+
"knowledge_source_sync_wakes",
|
|
271
409
|
"machine_metrics_latest",
|
|
272
410
|
"machine_metrics_series",
|
|
411
|
+
"machine_removal_operations",
|
|
273
412
|
"managed_accounts",
|
|
413
|
+
"memory_slack_publication_configurations",
|
|
414
|
+
"memory_slack_publication_receipts",
|
|
415
|
+
"memory_slack_publications",
|
|
274
416
|
"model_call_facts",
|
|
275
417
|
"new_session_drafts",
|
|
418
|
+
"pack_installation_components",
|
|
276
419
|
"pack_installations",
|
|
420
|
+
"retained_screenshot_artifacts",
|
|
277
421
|
"rig_changes",
|
|
278
422
|
"rig_versions",
|
|
279
423
|
"rigs",
|
|
@@ -323,6 +467,8 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
323
467
|
"transcription_recording_segments",
|
|
324
468
|
"transcription_recordings",
|
|
325
469
|
"usage_events",
|
|
470
|
+
"video_generation_operations",
|
|
471
|
+
"video_generation_references",
|
|
326
472
|
"workspace_artifacts",
|
|
327
473
|
"workspace_captures",
|
|
328
474
|
"workspace_control_events",
|
|
@@ -331,21 +477,45 @@ var RUNTIME_FULL_DML_TABLES = [
|
|
|
331
477
|
"workspace_memberships",
|
|
332
478
|
"workspace_model_policies",
|
|
333
479
|
"workspace_packs",
|
|
334
|
-
"
|
|
480
|
+
"workspace_screenshot_quotas",
|
|
335
481
|
"workspace_variable_set_variables",
|
|
336
482
|
"workspace_variable_sets",
|
|
483
|
+
"workspace_video_generation_policies",
|
|
484
|
+
"workspace_video_generation_quotas",
|
|
337
485
|
"workspaces"
|
|
338
486
|
];
|
|
339
487
|
var RUNTIME_READ_ONLY_TABLES = [
|
|
488
|
+
"company_profile_activation_events",
|
|
489
|
+
"company_profile_heads",
|
|
490
|
+
"company_profile_snapshots",
|
|
340
491
|
"knowledge_lifecycle_events",
|
|
341
492
|
"knowledge_memory_lifecycle_events",
|
|
342
493
|
"knowledge_memory_relationships",
|
|
343
494
|
"nested_agent_depth_configuration",
|
|
344
495
|
"preference_registry_events",
|
|
345
496
|
"preference_registry_snapshots",
|
|
346
|
-
"
|
|
497
|
+
"slack_installation_bindings",
|
|
498
|
+
"workspace_instruction_policy_snapshots",
|
|
499
|
+
"workspace_learning_policy_activation_events",
|
|
500
|
+
"workspace_learning_policy_heads",
|
|
501
|
+
"workspace_learning_policy_snapshots"
|
|
347
502
|
];
|
|
503
|
+
var RUNTIME_READ_UPDATE_TABLES = ["workspace_session_activity_revisions"];
|
|
348
504
|
var RUNTIME_READ_INSERT_TABLES = [
|
|
505
|
+
"browser_revision_components",
|
|
506
|
+
"browser_revisions",
|
|
507
|
+
"company_profile_revisions",
|
|
508
|
+
"editable_artifact_blob_refs",
|
|
509
|
+
"editable_artifact_idempotency_receipts",
|
|
510
|
+
"editable_artifact_live_outbox",
|
|
511
|
+
"editable_artifact_materialization_jobs",
|
|
512
|
+
"editable_artifact_materialization_results",
|
|
513
|
+
"editable_artifact_operations",
|
|
514
|
+
"editable_artifact_sequence_checkpoints",
|
|
515
|
+
"editable_artifact_snapshots",
|
|
516
|
+
"editable_artifact_transactions",
|
|
517
|
+
"editable_artifact_undo_claims",
|
|
518
|
+
"editable_artifact_versions",
|
|
349
519
|
"knowledge_change_proposals",
|
|
350
520
|
"knowledge_claim_evidence",
|
|
351
521
|
"knowledge_claim_relations",
|
|
@@ -363,14 +533,50 @@ var RUNTIME_READ_INSERT_TABLES = [
|
|
|
363
533
|
"knowledge_sync_runs",
|
|
364
534
|
"preference_registry_preferences",
|
|
365
535
|
"preference_registry_revisions",
|
|
536
|
+
"session_attempt_tool_catalogs",
|
|
366
537
|
"session_spawn_denials",
|
|
538
|
+
"slack_user_link_access_request_operations",
|
|
539
|
+
"temporal_schedule_cleanup_outbox",
|
|
367
540
|
"workspace_artifact_events",
|
|
368
541
|
"workspace_artifact_versions",
|
|
369
542
|
"workspace_instruction_policy_activation_events",
|
|
370
543
|
"workspace_instruction_policy_onboarding_proposals",
|
|
371
|
-
"workspace_instruction_policy_revisions"
|
|
544
|
+
"workspace_instruction_policy_revisions",
|
|
545
|
+
"workspace_learning_policy_revisions"
|
|
546
|
+
];
|
|
547
|
+
var RUNTIME_READ_INSERT_UPDATE_TABLES = [
|
|
548
|
+
"attached_browser_devices",
|
|
549
|
+
"attached_browser_inventories",
|
|
550
|
+
"auth_runs",
|
|
551
|
+
"browser_identities",
|
|
552
|
+
"browser_sessions",
|
|
553
|
+
"browser_state_artifacts",
|
|
554
|
+
"capability_api_facets",
|
|
555
|
+
"capability_facets",
|
|
556
|
+
"capability_integration_facets",
|
|
557
|
+
"capability_mcp_facets",
|
|
558
|
+
"capability_plugin_versions",
|
|
559
|
+
"capability_plugins",
|
|
560
|
+
"capability_skill_facets",
|
|
561
|
+
"capability_skill_files",
|
|
562
|
+
"computer_sessions",
|
|
563
|
+
"editable_artifact_session_links",
|
|
564
|
+
"editable_artifacts",
|
|
565
|
+
"integration_feature_facets",
|
|
566
|
+
"integration_spec_revisions",
|
|
567
|
+
"integration_tools",
|
|
568
|
+
"interaction_interventions",
|
|
569
|
+
"interaction_operations",
|
|
570
|
+
"interaction_resource_operations",
|
|
571
|
+
"network_routes",
|
|
572
|
+
"session_attempt_codemode_calls",
|
|
573
|
+
"site_auth_connections",
|
|
574
|
+
"slack_user_link_access_requests",
|
|
575
|
+
"workspace_interaction_revisions"
|
|
372
576
|
];
|
|
373
577
|
var PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
578
|
+
"editable_artifact_live_tickets",
|
|
579
|
+
"editable_artifact_scope_authorization_heads",
|
|
374
580
|
"host_export_config",
|
|
375
581
|
"host_export_consumers",
|
|
376
582
|
"host_export_cursor_state",
|
|
@@ -381,8 +587,17 @@ var FULL_DML_PRIVILEGES = ["SELECT", "INSERT", "UPDATE", "DELETE"];
|
|
|
381
587
|
var RUNTIME_TABLE_PRIVILEGES = Object.freeze({
|
|
382
588
|
...Object.fromEntries(RUNTIME_FULL_DML_TABLES.map((table) => [table, FULL_DML_PRIVILEGES])),
|
|
383
589
|
...Object.fromEntries(RUNTIME_READ_ONLY_TABLES.map((table) => [table, ["SELECT"]])),
|
|
590
|
+
...Object.fromEntries(
|
|
591
|
+
RUNTIME_READ_UPDATE_TABLES.map((table) => [table, ["SELECT", "UPDATE"]])
|
|
592
|
+
),
|
|
384
593
|
...Object.fromEntries(
|
|
385
594
|
RUNTIME_READ_INSERT_TABLES.map((table) => [table, ["SELECT", "INSERT"]])
|
|
595
|
+
),
|
|
596
|
+
...Object.fromEntries(
|
|
597
|
+
RUNTIME_READ_INSERT_UPDATE_TABLES.map((table) => [
|
|
598
|
+
table,
|
|
599
|
+
["SELECT", "INSERT", "UPDATE"]
|
|
600
|
+
])
|
|
386
601
|
)
|
|
387
602
|
});
|
|
388
603
|
var RUNTIME_DML_TABLES = Object.freeze(
|
|
@@ -464,6 +679,7 @@ async function inspectRuntimeDatabasePosture(db, options) {
|
|
|
464
679
|
ownedSchemas: [],
|
|
465
680
|
ownedRelations: [],
|
|
466
681
|
tables: [],
|
|
682
|
+
targetRoutines: [],
|
|
467
683
|
privateRoutines: []
|
|
468
684
|
};
|
|
469
685
|
}
|
|
@@ -516,6 +732,16 @@ async function inspectRuntimeDatabasePosture(db, options) {
|
|
|
516
732
|
c.relforcerowsecurity as rls_forced,
|
|
517
733
|
row_security_active(c.oid) as rls_active,
|
|
518
734
|
(select count(*)::int from pg_policy policy where policy.polrelid = c.oid) as policy_count,
|
|
735
|
+
exists(
|
|
736
|
+
select 1 from pg_policy policy
|
|
737
|
+
where policy.polrelid = c.oid
|
|
738
|
+
and policy.polname = 'editable_artifact_outbox_dispatcher'
|
|
739
|
+
) as artifact_outbox_dispatcher_policy,
|
|
740
|
+
exists(
|
|
741
|
+
select 1 from pg_policy policy
|
|
742
|
+
where policy.polrelid = c.oid
|
|
743
|
+
and policy.polname = 'editable_artifact_materializer_owner'
|
|
744
|
+
) as artifact_materializer_policy,
|
|
519
745
|
has_table_privilege(current_user, c.oid, 'SELECT') as can_select,
|
|
520
746
|
has_table_privilege(current_user, c.oid, 'INSERT') as can_insert,
|
|
521
747
|
has_table_privilege(current_user, c.oid, 'UPDATE') as can_update,
|
|
@@ -536,6 +762,8 @@ async function inspectRuntimeDatabasePosture(db, options) {
|
|
|
536
762
|
rlsForced: row.rls_forced,
|
|
537
763
|
rlsActive: row.rls_active,
|
|
538
764
|
policyCount: row.policy_count,
|
|
765
|
+
artifactOutboxDispatcherPolicy: row.artifact_outbox_dispatcher_policy,
|
|
766
|
+
artifactMaterializerPolicy: row.artifact_materializer_policy,
|
|
539
767
|
select: row.can_select,
|
|
540
768
|
insert: row.can_insert,
|
|
541
769
|
update: row.can_update,
|
|
@@ -544,22 +772,55 @@ async function inspectRuntimeDatabasePosture(db, options) {
|
|
|
544
772
|
references: row.can_references,
|
|
545
773
|
trigger: row.can_trigger
|
|
546
774
|
}));
|
|
775
|
+
const targetRoutines = resultRows(
|
|
776
|
+
await tx.execute(sql`
|
|
777
|
+
select
|
|
778
|
+
(p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')')::text as name,
|
|
779
|
+
pg_get_userbyid(p.proowner)::text as owner,
|
|
780
|
+
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute,
|
|
781
|
+
exists (
|
|
782
|
+
select 1
|
|
783
|
+
from aclexplode(coalesce(p.proacl, acldefault('f', p.proowner))) acl
|
|
784
|
+
where acl.grantee = 0 and acl.privilege_type = 'EXECUTE'
|
|
785
|
+
) as public_execute,
|
|
786
|
+
p.prosecdef as security_definer
|
|
787
|
+
from pg_proc p
|
|
788
|
+
join pg_namespace n on n.oid = p.pronamespace
|
|
789
|
+
where p.oid = to_regprocedure(
|
|
790
|
+
format(
|
|
791
|
+
'%I.knowledge_source_sync_lock_authority(uuid,uuid,uuid)',
|
|
792
|
+
${targetSchema}::text
|
|
793
|
+
)
|
|
794
|
+
)
|
|
795
|
+
and n.nspname = ${targetSchema}
|
|
796
|
+
and p.prokind in ('f', 'p')
|
|
797
|
+
order by p.proname, pg_catalog.oidvectortypes(p.proargtypes)
|
|
798
|
+
`)
|
|
799
|
+
).map((row) => ({
|
|
800
|
+
name: row.name,
|
|
801
|
+
owner: row.owner,
|
|
802
|
+
execute: row.can_execute,
|
|
803
|
+
publicExecute: row.public_execute,
|
|
804
|
+
securityDefiner: row.security_definer
|
|
805
|
+
}));
|
|
547
806
|
const privateRoutines = resultRows(
|
|
548
807
|
await tx.execute(sql`
|
|
549
808
|
select
|
|
550
|
-
(p.proname || '(' ||
|
|
809
|
+
(p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')')::text as name,
|
|
551
810
|
pg_get_userbyid(p.proowner)::text as owner,
|
|
552
|
-
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute
|
|
811
|
+
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute,
|
|
812
|
+
p.prosecdef as security_definer
|
|
553
813
|
from pg_proc p
|
|
554
814
|
join pg_namespace n on n.oid = p.pronamespace
|
|
555
815
|
where n.nspname = 'opengeni_private'
|
|
556
816
|
and p.prokind in ('f', 'p')
|
|
557
|
-
order by p.proname,
|
|
817
|
+
order by p.proname, pg_catalog.oidvectortypes(p.proargtypes)
|
|
558
818
|
`)
|
|
559
819
|
).map((row) => ({
|
|
560
820
|
name: row.name,
|
|
561
821
|
owner: row.owner,
|
|
562
|
-
execute: row.can_execute
|
|
822
|
+
execute: row.can_execute,
|
|
823
|
+
securityDefiner: row.security_definer
|
|
563
824
|
}));
|
|
564
825
|
return {
|
|
565
826
|
identity: mappedIdentity,
|
|
@@ -568,6 +829,7 @@ async function inspectRuntimeDatabasePosture(db, options) {
|
|
|
568
829
|
ownedSchemas,
|
|
569
830
|
ownedRelations,
|
|
570
831
|
tables,
|
|
832
|
+
targetRoutines,
|
|
571
833
|
privateRoutines
|
|
572
834
|
};
|
|
573
835
|
},
|
|
@@ -718,6 +980,217 @@ function evaluateRuntimeDatabasePosture(posture, options) {
|
|
|
718
980
|
if (!table.rlsActive) violations.push(`table ${tableName} has inactive RLS for runtime role`);
|
|
719
981
|
if (table.policyCount < 1) violations.push(`table ${tableName} has no RLS policy`);
|
|
720
982
|
}
|
|
983
|
+
const targetSchemaOwner = posture.schemas.find((schema) => schema.name === targetSchema)?.owner;
|
|
984
|
+
for (const expectedRoutine of RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES) {
|
|
985
|
+
const matches = posture.targetRoutines.filter((routine2) => routine2.name === expectedRoutine);
|
|
986
|
+
if (matches.length !== 1) {
|
|
987
|
+
violations.push(
|
|
988
|
+
`target-schema runtime capability ${expectedRoutine} is missing or ambiguous`
|
|
989
|
+
);
|
|
990
|
+
continue;
|
|
991
|
+
}
|
|
992
|
+
const routine = matches[0];
|
|
993
|
+
if (!routine.securityDefiner) {
|
|
994
|
+
violations.push(`target-schema runtime capability ${routine.name} is not SECURITY DEFINER`);
|
|
995
|
+
}
|
|
996
|
+
if (routine.name === KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE) {
|
|
997
|
+
const missingAuthorityTables = KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES.filter(
|
|
998
|
+
(tableName) => !tableByName.has(tableName)
|
|
999
|
+
);
|
|
1000
|
+
if (missingAuthorityTables.length > 0) {
|
|
1001
|
+
violations.push(
|
|
1002
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`
|
|
1003
|
+
);
|
|
1004
|
+
} else {
|
|
1005
|
+
const authorityTables = KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES.map(
|
|
1006
|
+
(tableName) => tableByName.get(tableName)
|
|
1007
|
+
);
|
|
1008
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
1009
|
+
if (authorityOwners.size !== 1) {
|
|
1010
|
+
violations.push(
|
|
1011
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`
|
|
1012
|
+
);
|
|
1013
|
+
} else if (routine.owner !== authorityTables[0].owner) {
|
|
1014
|
+
violations.push(
|
|
1015
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0].owner}`
|
|
1016
|
+
);
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
} else if (targetSchemaOwner && routine.owner !== targetSchemaOwner) {
|
|
1020
|
+
violations.push(
|
|
1021
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match schema owner ${targetSchemaOwner}`
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
if (!routine.execute) {
|
|
1025
|
+
violations.push(`runtime role lacks target-schema capability ${routine.name}`);
|
|
1026
|
+
}
|
|
1027
|
+
if (routine.publicExecute) {
|
|
1028
|
+
violations.push(`PUBLIC has forbidden target-schema capability ${routine.name}`);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
const artifactOutbox = tableByName.get("editable_artifact_live_outbox");
|
|
1032
|
+
if (artifactOutbox) {
|
|
1033
|
+
if (!artifactOutbox.artifactOutboxDispatcherPolicy) {
|
|
1034
|
+
violations.push("table editable_artifact_live_outbox lacks its owner dispatcher RLS policy");
|
|
1035
|
+
}
|
|
1036
|
+
for (const expectedRoutine of ARTIFACT_OUTBOX_CAPABILITY_ROUTINES) {
|
|
1037
|
+
const matches = posture.privateRoutines.filter((routine2) => routine2.name === expectedRoutine);
|
|
1038
|
+
if (matches.length !== 1) {
|
|
1039
|
+
violations.push(`artifact outbox capability ${expectedRoutine} is missing or ambiguous`);
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
const routine = matches[0];
|
|
1043
|
+
if (!routine.securityDefiner) {
|
|
1044
|
+
violations.push(`artifact outbox capability ${routine.name} is not SECURITY DEFINER`);
|
|
1045
|
+
}
|
|
1046
|
+
if (routine.owner !== artifactOutbox.owner) {
|
|
1047
|
+
violations.push(
|
|
1048
|
+
`artifact outbox capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactOutbox.owner}`
|
|
1049
|
+
);
|
|
1050
|
+
}
|
|
1051
|
+
if (routine.execute) {
|
|
1052
|
+
violations.push(
|
|
1053
|
+
`generic runtime role has forbidden global artifact outbox capability ${routine.name}`
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
const artifactMaterializationJobs = tableByName.get("editable_artifact_materialization_jobs");
|
|
1059
|
+
if (artifactMaterializationJobs) {
|
|
1060
|
+
for (const tableName of [
|
|
1061
|
+
"editable_artifact_materialization_jobs",
|
|
1062
|
+
"editable_artifact_materialization_results",
|
|
1063
|
+
"editable_artifact_blob_refs",
|
|
1064
|
+
"editable_artifact_sequence_checkpoints",
|
|
1065
|
+
"editable_artifact_versions",
|
|
1066
|
+
"editable_artifact_idempotency_receipts"
|
|
1067
|
+
]) {
|
|
1068
|
+
const table = tableByName.get(tableName);
|
|
1069
|
+
if (table && !table.artifactMaterializerPolicy) {
|
|
1070
|
+
violations.push(`table ${tableName} lacks its owner materializer RLS policy`);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
for (const expectedRoutine of ARTIFACT_MATERIALIZER_CAPABILITY_ROUTINES) {
|
|
1074
|
+
const matches = posture.privateRoutines.filter((routine2) => routine2.name === expectedRoutine);
|
|
1075
|
+
if (matches.length !== 1) {
|
|
1076
|
+
violations.push(
|
|
1077
|
+
`artifact materializer capability ${expectedRoutine} is missing or ambiguous`
|
|
1078
|
+
);
|
|
1079
|
+
continue;
|
|
1080
|
+
}
|
|
1081
|
+
const routine = matches[0];
|
|
1082
|
+
if (!routine.securityDefiner) {
|
|
1083
|
+
violations.push(`artifact materializer capability ${routine.name} is not SECURITY DEFINER`);
|
|
1084
|
+
}
|
|
1085
|
+
if (routine.owner !== artifactMaterializationJobs.owner) {
|
|
1086
|
+
violations.push(
|
|
1087
|
+
`artifact materializer capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactMaterializationJobs.owner}`
|
|
1088
|
+
);
|
|
1089
|
+
}
|
|
1090
|
+
if (routine.execute) {
|
|
1091
|
+
violations.push(
|
|
1092
|
+
`generic runtime role has forbidden global artifact materializer capability ${routine.name}`
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
const artifactAuthority = tableByName.get("editable_artifacts");
|
|
1098
|
+
if (artifactAuthority) {
|
|
1099
|
+
const matches = posture.privateRoutines.filter(
|
|
1100
|
+
(routine) => routine.name.startsWith("advance_editable_artifact_authorization_revision(")
|
|
1101
|
+
);
|
|
1102
|
+
if (matches.length !== 1) {
|
|
1103
|
+
violations.push(
|
|
1104
|
+
"editable artifact authorization revision capability is missing or ambiguous"
|
|
1105
|
+
);
|
|
1106
|
+
} else {
|
|
1107
|
+
const routine = matches[0];
|
|
1108
|
+
if (!routine.securityDefiner) {
|
|
1109
|
+
violations.push(
|
|
1110
|
+
`editable artifact authorization revision capability ${routine.name} is not SECURITY DEFINER`
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
if (routine.owner !== artifactAuthority.owner) {
|
|
1114
|
+
violations.push(
|
|
1115
|
+
`editable artifact authorization revision capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactAuthority.owner}`
|
|
1116
|
+
);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
for (const expectedRoutine of ARTIFACT_AUTHORIZATION_CAPABILITY_ROUTINES) {
|
|
1120
|
+
const capabilityMatches = posture.privateRoutines.filter(
|
|
1121
|
+
(routine2) => routine2.name === expectedRoutine
|
|
1122
|
+
);
|
|
1123
|
+
if (capabilityMatches.length !== 1) {
|
|
1124
|
+
violations.push(
|
|
1125
|
+
`editable artifact authorization capability ${expectedRoutine} is missing or ambiguous`
|
|
1126
|
+
);
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
const routine = capabilityMatches[0];
|
|
1130
|
+
if (!routine.securityDefiner) {
|
|
1131
|
+
violations.push(
|
|
1132
|
+
`editable artifact authorization capability ${routine.name} is not SECURITY DEFINER`
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
if (routine.owner !== artifactAuthority.owner) {
|
|
1136
|
+
violations.push(
|
|
1137
|
+
`editable artifact authorization capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactAuthority.owner}`
|
|
1138
|
+
);
|
|
1139
|
+
}
|
|
1140
|
+
if (!routine.execute) {
|
|
1141
|
+
violations.push(
|
|
1142
|
+
`runtime role lacks editable artifact authorization capability ${routine.name}`
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
const artifactLiveTickets = tableByName.get("editable_artifact_live_tickets");
|
|
1148
|
+
if (artifactLiveTickets) {
|
|
1149
|
+
for (const expectedRoutine of ARTIFACT_LIVE_TICKET_CAPABILITY_ROUTINES) {
|
|
1150
|
+
const matches = posture.privateRoutines.filter((routine2) => routine2.name === expectedRoutine);
|
|
1151
|
+
if (matches.length !== 1) {
|
|
1152
|
+
violations.push(
|
|
1153
|
+
`artifact live ticket capability ${expectedRoutine} is missing or ambiguous`
|
|
1154
|
+
);
|
|
1155
|
+
continue;
|
|
1156
|
+
}
|
|
1157
|
+
const routine = matches[0];
|
|
1158
|
+
if (!routine.securityDefiner) {
|
|
1159
|
+
violations.push(`artifact live ticket capability ${routine.name} is not SECURITY DEFINER`);
|
|
1160
|
+
}
|
|
1161
|
+
if (routine.owner !== artifactLiveTickets.owner) {
|
|
1162
|
+
violations.push(
|
|
1163
|
+
`artifact live ticket capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactLiveTickets.owner}`
|
|
1164
|
+
);
|
|
1165
|
+
}
|
|
1166
|
+
if (!routine.execute) {
|
|
1167
|
+
violations.push(`runtime role lacks artifact live ticket capability ${routine.name}`);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
for (const internalRoutine of ARTIFACT_LIVE_TICKET_INTERNAL_ROUTINES) {
|
|
1171
|
+
const matches = posture.privateRoutines.filter((routine2) => routine2.name === internalRoutine);
|
|
1172
|
+
if (matches.length !== 1) {
|
|
1173
|
+
violations.push(
|
|
1174
|
+
`artifact live ticket internal routine ${internalRoutine} is missing or ambiguous`
|
|
1175
|
+
);
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
const routine = matches[0];
|
|
1179
|
+
if (!routine.securityDefiner) {
|
|
1180
|
+
violations.push(
|
|
1181
|
+
`artifact live ticket internal routine ${routine.name} is not SECURITY DEFINER`
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
if (routine.owner !== artifactLiveTickets.owner) {
|
|
1185
|
+
violations.push(
|
|
1186
|
+
`artifact live ticket internal routine ${routine.name} owner ${routine.owner} does not match table owner ${artifactLiveTickets.owner}`
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
if (routine.execute) {
|
|
1190
|
+
violations.push(`runtime role has forbidden ticket schema resolver ${routine.name}`);
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
721
1194
|
if (posture.privateRoutines.length === 0) {
|
|
722
1195
|
violations.push("opengeni_private has no helper routines");
|
|
723
1196
|
}
|
|
@@ -725,7 +1198,8 @@ function evaluateRuntimeDatabasePosture(posture, options) {
|
|
|
725
1198
|
if (routine.owner === expectedRole) {
|
|
726
1199
|
violations.push(`runtime role owns private routine ${routine.name}`);
|
|
727
1200
|
}
|
|
728
|
-
|
|
1201
|
+
const dedicatedArtifactCapability = DEDICATED_ARTIFACT_CAPABILITY_ROUTINES.has(routine.name);
|
|
1202
|
+
if (!routine.execute && !dedicatedArtifactCapability) {
|
|
729
1203
|
violations.push(`runtime role lacks EXECUTE on private routine ${routine.name}`);
|
|
730
1204
|
}
|
|
731
1205
|
}
|
|
@@ -754,6 +1228,16 @@ async function provisionRoles(adminConnection, options = {}) {
|
|
|
754
1228
|
options.appRole ?? (process.env.OPENGENI_APP_DATABASE_USER?.trim() || "opengeni_app")
|
|
755
1229
|
);
|
|
756
1230
|
const appPassword = options.appPassword ?? process.env.OPENGENI_APP_DATABASE_PASSWORD;
|
|
1231
|
+
const artifactOutboxDispatcherRole = validateIdentifier(
|
|
1232
|
+
"artifactOutboxDispatcherRole",
|
|
1233
|
+
options.artifactOutboxDispatcherRole ?? (process.env.OPENGENI_ARTIFACT_OUTBOX_DATABASE_USER?.trim() || "opengeni_artifact_outbox_dispatcher")
|
|
1234
|
+
);
|
|
1235
|
+
const artifactOutboxDispatcherPassword = options.artifactOutboxDispatcherPassword ?? process.env.OPENGENI_ARTIFACT_OUTBOX_DATABASE_PASSWORD;
|
|
1236
|
+
const artifactMaterializerRole = validateIdentifier(
|
|
1237
|
+
"artifactMaterializerRole",
|
|
1238
|
+
options.artifactMaterializerRole ?? (process.env.OPENGENI_ARTIFACT_MATERIALIZER_DATABASE_USER?.trim() || "opengeni_artifact_materializer")
|
|
1239
|
+
);
|
|
1240
|
+
const artifactMaterializerPassword = options.artifactMaterializerPassword ?? process.env.OPENGENI_ARTIFACT_MATERIALIZER_DATABASE_PASSWORD;
|
|
757
1241
|
const hostExportRole = validateIdentifier(
|
|
758
1242
|
"hostExportRole",
|
|
759
1243
|
options.hostExportRole ?? (process.env.OPENGENI_HOST_EXPORT_DATABASE_USER?.trim() || "opengeni_host_exporter")
|
|
@@ -778,6 +1262,38 @@ async function provisionRoles(adminConnection, options = {}) {
|
|
|
778
1262
|
await ensureRestrictedAppLoginRole(sql2, appRole, appPassword);
|
|
779
1263
|
provisionedAppRole = appRole;
|
|
780
1264
|
}
|
|
1265
|
+
let provisionedArtifactOutboxDispatcherRole = null;
|
|
1266
|
+
if (artifactOutboxDispatcherPassword) {
|
|
1267
|
+
await assertAppRoleSafeToNormalize(sql2, artifactOutboxDispatcherRole);
|
|
1268
|
+
await ensureRestrictedAppLoginRole(
|
|
1269
|
+
sql2,
|
|
1270
|
+
artifactOutboxDispatcherRole,
|
|
1271
|
+
artifactOutboxDispatcherPassword
|
|
1272
|
+
);
|
|
1273
|
+
await grantArtifactCapabilityRoleIfSchemaExists(
|
|
1274
|
+
sql2,
|
|
1275
|
+
artifactOutboxDispatcherRole,
|
|
1276
|
+
schema,
|
|
1277
|
+
"outbox"
|
|
1278
|
+
);
|
|
1279
|
+
provisionedArtifactOutboxDispatcherRole = artifactOutboxDispatcherRole;
|
|
1280
|
+
}
|
|
1281
|
+
let provisionedArtifactMaterializerRole = null;
|
|
1282
|
+
if (artifactMaterializerPassword) {
|
|
1283
|
+
await assertAppRoleSafeToNormalize(sql2, artifactMaterializerRole);
|
|
1284
|
+
await ensureRestrictedAppLoginRole(
|
|
1285
|
+
sql2,
|
|
1286
|
+
artifactMaterializerRole,
|
|
1287
|
+
artifactMaterializerPassword
|
|
1288
|
+
);
|
|
1289
|
+
await grantArtifactCapabilityRoleIfSchemaExists(
|
|
1290
|
+
sql2,
|
|
1291
|
+
artifactMaterializerRole,
|
|
1292
|
+
schema,
|
|
1293
|
+
"materializer"
|
|
1294
|
+
);
|
|
1295
|
+
provisionedArtifactMaterializerRole = artifactMaterializerRole;
|
|
1296
|
+
}
|
|
781
1297
|
if (temporalPassword) {
|
|
782
1298
|
await ensureLoginRole(sql2, temporalRole, temporalPassword);
|
|
783
1299
|
for (const database of temporalDatabases) {
|
|
@@ -794,6 +1310,8 @@ async function provisionRoles(adminConnection, options = {}) {
|
|
|
794
1310
|
}
|
|
795
1311
|
return {
|
|
796
1312
|
appRole: provisionedAppRole,
|
|
1313
|
+
artifactOutboxDispatcherRole: provisionedArtifactOutboxDispatcherRole,
|
|
1314
|
+
artifactMaterializerRole: provisionedArtifactMaterializerRole,
|
|
797
1315
|
hostExportRole: hostExportPassword ? hostExportRole : null,
|
|
798
1316
|
temporalRole: temporalPassword ? temporalRole : null,
|
|
799
1317
|
temporalDatabases: temporalPassword ? temporalDatabases : [],
|
|
@@ -816,6 +1334,55 @@ BEGIN
|
|
|
816
1334
|
END $$;
|
|
817
1335
|
`);
|
|
818
1336
|
}
|
|
1337
|
+
async function grantArtifactCapabilityRoleIfSchemaExists(sql2, role, dataSchema, capability) {
|
|
1338
|
+
const routines = capability === "outbox" ? [
|
|
1339
|
+
"claim_editable_artifact_live_outbox(text,integer,integer,name)",
|
|
1340
|
+
"mark_editable_artifact_live_outbox_published(text,text,integer,name)",
|
|
1341
|
+
"renew_editable_artifact_live_outbox(text,text,integer,integer,name)",
|
|
1342
|
+
"retry_editable_artifact_live_outbox(text,text,integer,integer,text,name)",
|
|
1343
|
+
"dead_letter_editable_artifact_live_outbox(text,text,integer,text,name)",
|
|
1344
|
+
"release_editable_artifact_live_outbox(text,text,integer,name)"
|
|
1345
|
+
] : [
|
|
1346
|
+
"claim_editable_artifact_materializations(text,integer,integer,name)",
|
|
1347
|
+
"renew_editable_artifact_materialization(uuid,uuid,text,text,text,integer,integer,name)",
|
|
1348
|
+
"succeed_editable_artifact_materialization(uuid,uuid,text,text,text,integer,text,text,text,bigint,text,text,timestamp with time zone,name)",
|
|
1349
|
+
"fail_editable_artifact_materialization(uuid,uuid,text,text,text,integer,text,name)"
|
|
1350
|
+
];
|
|
1351
|
+
const routineArray = `ARRAY[${routines.map(literal).join(", ")}]`;
|
|
1352
|
+
await sql2.unsafe(`
|
|
1353
|
+
DO $$
|
|
1354
|
+
DECLARE routine_signature text;
|
|
1355
|
+
BEGIN
|
|
1356
|
+
IF EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = ${literal(dataSchema)})
|
|
1357
|
+
AND EXISTS (SELECT 1 FROM pg_namespace WHERE nspname = 'opengeni_private')
|
|
1358
|
+
THEN
|
|
1359
|
+
EXECUTE format('GRANT CONNECT ON DATABASE %I TO %I', current_database(), ${literal(role)});
|
|
1360
|
+
EXECUTE format('GRANT USAGE ON SCHEMA %I TO %I', ${literal(dataSchema)}, ${literal(role)});
|
|
1361
|
+
EXECUTE format('GRANT USAGE ON SCHEMA opengeni_private TO %I', ${literal(role)});
|
|
1362
|
+
EXECUTE format(
|
|
1363
|
+
'REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA %I FROM %I',
|
|
1364
|
+
${literal(dataSchema)}, ${literal(role)}
|
|
1365
|
+
);
|
|
1366
|
+
EXECUTE format(
|
|
1367
|
+
'REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA %I FROM %I',
|
|
1368
|
+
${literal(dataSchema)}, ${literal(role)}
|
|
1369
|
+
);
|
|
1370
|
+
EXECUTE format(
|
|
1371
|
+
'REVOKE ALL PRIVILEGES ON ALL FUNCTIONS IN SCHEMA opengeni_private FROM %I',
|
|
1372
|
+
${literal(role)}
|
|
1373
|
+
);
|
|
1374
|
+
FOREACH routine_signature IN ARRAY ${routineArray} LOOP
|
|
1375
|
+
IF to_regprocedure('opengeni_private.' || routine_signature) IS NOT NULL THEN
|
|
1376
|
+
EXECUTE format(
|
|
1377
|
+
'GRANT EXECUTE ON FUNCTION opengeni_private.%s TO %I',
|
|
1378
|
+
routine_signature, ${literal(role)}
|
|
1379
|
+
);
|
|
1380
|
+
END IF;
|
|
1381
|
+
END LOOP;
|
|
1382
|
+
END IF;
|
|
1383
|
+
END $$;
|
|
1384
|
+
`);
|
|
1385
|
+
}
|
|
819
1386
|
async function ensureLoginRole(sql2, role, password) {
|
|
820
1387
|
await sql2.unsafe(`
|
|
821
1388
|
DO $$
|
|
@@ -962,7 +1529,9 @@ async function grantTemporalRoleInDatabase(adminConnection, database, role) {
|
|
|
962
1529
|
async function grantAppRoleIfSchemaExists(sql2, role, schema) {
|
|
963
1530
|
const runtimeFullDmlTables = `ARRAY[${RUNTIME_FULL_DML_TABLES.map(literal).join(", ")}]`;
|
|
964
1531
|
const runtimeReadOnlyTables = `ARRAY[${RUNTIME_READ_ONLY_TABLES.map(literal).join(", ")}]`;
|
|
1532
|
+
const runtimeReadUpdateTables = `ARRAY[${RUNTIME_READ_UPDATE_TABLES.map(literal).join(", ")}]`;
|
|
965
1533
|
const runtimeReadInsertTables = `ARRAY[${RUNTIME_READ_INSERT_TABLES.map(literal).join(", ")}]`;
|
|
1534
|
+
const runtimeReadInsertUpdateTables = `ARRAY[${RUNTIME_READ_INSERT_UPDATE_TABLES.map(literal).join(", ")}]`;
|
|
966
1535
|
await sql2.unsafe(`
|
|
967
1536
|
DO $$
|
|
968
1537
|
DECLARE
|
|
@@ -994,6 +1563,16 @@ BEGIN
|
|
|
994
1563
|
);
|
|
995
1564
|
END IF;
|
|
996
1565
|
END LOOP;
|
|
1566
|
+
FOREACH runtime_table IN ARRAY ${runtimeReadUpdateTables} LOOP
|
|
1567
|
+
IF to_regclass(format('%I.%I', ${literal(schema)}, runtime_table)) IS NOT NULL THEN
|
|
1568
|
+
EXECUTE format(
|
|
1569
|
+
'GRANT SELECT, UPDATE ON TABLE %I.%I TO %I',
|
|
1570
|
+
${literal(schema)},
|
|
1571
|
+
runtime_table,
|
|
1572
|
+
${literal(role)}
|
|
1573
|
+
);
|
|
1574
|
+
END IF;
|
|
1575
|
+
END LOOP;
|
|
997
1576
|
FOREACH runtime_table IN ARRAY ${runtimeReadInsertTables} LOOP
|
|
998
1577
|
IF to_regclass(format('%I.%I', ${literal(schema)}, runtime_table)) IS NOT NULL THEN
|
|
999
1578
|
EXECUTE format(
|
|
@@ -1004,6 +1583,16 @@ BEGIN
|
|
|
1004
1583
|
);
|
|
1005
1584
|
END IF;
|
|
1006
1585
|
END LOOP;
|
|
1586
|
+
FOREACH runtime_table IN ARRAY ${runtimeReadInsertUpdateTables} LOOP
|
|
1587
|
+
IF to_regclass(format('%I.%I', ${literal(schema)}, runtime_table)) IS NOT NULL THEN
|
|
1588
|
+
EXECUTE format(
|
|
1589
|
+
'GRANT SELECT, INSERT, UPDATE ON TABLE %I.%I TO %I',
|
|
1590
|
+
${literal(schema)},
|
|
1591
|
+
runtime_table,
|
|
1592
|
+
${literal(role)}
|
|
1593
|
+
);
|
|
1594
|
+
END IF;
|
|
1595
|
+
END LOOP;
|
|
1007
1596
|
-- Migration 0110 creates this target-schema-local SECURITY DEFINER
|
|
1008
1597
|
-- capability before opengeni_app may exist. Re-converge its exact EXECUTE
|
|
1009
1598
|
-- grant here so the supported migrate-then-provision order is equivalent to
|
|
@@ -1086,6 +1675,72 @@ BEGIN
|
|
|
1086
1675
|
${literal(role)}
|
|
1087
1676
|
);
|
|
1088
1677
|
END IF;
|
|
1678
|
+
IF to_regprocedure(
|
|
1679
|
+
format(
|
|
1680
|
+
'%I.company_profile_apply_activation(uuid,text,uuid,uuid,uuid,uuid,bigint,text,text,text,text)',
|
|
1681
|
+
${literal(schema)}
|
|
1682
|
+
)
|
|
1683
|
+
) IS NOT NULL THEN
|
|
1684
|
+
EXECUTE format(
|
|
1685
|
+
'GRANT EXECUTE ON FUNCTION %I.company_profile_apply_activation(uuid, text, uuid, uuid, uuid, uuid, bigint, text, text, text, text) TO %I',
|
|
1686
|
+
${literal(schema)},
|
|
1687
|
+
${literal(role)}
|
|
1688
|
+
);
|
|
1689
|
+
END IF;
|
|
1690
|
+
IF to_regprocedure(
|
|
1691
|
+
format(
|
|
1692
|
+
'%I.company_profile_get_or_create_snapshot(uuid,uuid,uuid,uuid,uuid,integer)',
|
|
1693
|
+
${literal(schema)}
|
|
1694
|
+
)
|
|
1695
|
+
) IS NOT NULL THEN
|
|
1696
|
+
EXECUTE format(
|
|
1697
|
+
'GRANT EXECUTE ON FUNCTION %I.company_profile_get_or_create_snapshot(uuid, uuid, uuid, uuid, uuid, integer) TO %I',
|
|
1698
|
+
${literal(schema)},
|
|
1699
|
+
${literal(role)}
|
|
1700
|
+
);
|
|
1701
|
+
END IF;
|
|
1702
|
+
IF to_regprocedure(
|
|
1703
|
+
format(
|
|
1704
|
+
'%I.workspace_learning_policy_apply_activation(uuid,text,uuid,uuid,uuid,uuid,bigint,text,text,text)',
|
|
1705
|
+
${literal(schema)}
|
|
1706
|
+
)
|
|
1707
|
+
) IS NOT NULL THEN
|
|
1708
|
+
EXECUTE format(
|
|
1709
|
+
'GRANT EXECUTE ON FUNCTION %I.workspace_learning_policy_apply_activation(uuid, text, uuid, uuid, uuid, uuid, bigint, text, text, text) TO %I',
|
|
1710
|
+
${literal(schema)},
|
|
1711
|
+
${literal(role)}
|
|
1712
|
+
);
|
|
1713
|
+
END IF;
|
|
1714
|
+
IF to_regprocedure(
|
|
1715
|
+
format('%I.workspace_learning_policy_source_overrides_valid(jsonb)', ${literal(schema)})
|
|
1716
|
+
) IS NOT NULL THEN
|
|
1717
|
+
EXECUTE format(
|
|
1718
|
+
'GRANT EXECUTE ON FUNCTION %I.workspace_learning_policy_source_overrides_valid(jsonb) TO %I',
|
|
1719
|
+
${literal(schema)},
|
|
1720
|
+
${literal(role)}
|
|
1721
|
+
);
|
|
1722
|
+
END IF;
|
|
1723
|
+
IF to_regprocedure(
|
|
1724
|
+
format('%I.workspace_learning_policy_hash(text,jsonb)', ${literal(schema)})
|
|
1725
|
+
) IS NOT NULL THEN
|
|
1726
|
+
EXECUTE format(
|
|
1727
|
+
'GRANT EXECUTE ON FUNCTION %I.workspace_learning_policy_hash(text, jsonb) TO %I',
|
|
1728
|
+
${literal(schema)},
|
|
1729
|
+
${literal(role)}
|
|
1730
|
+
);
|
|
1731
|
+
END IF;
|
|
1732
|
+
IF to_regprocedure(
|
|
1733
|
+
format(
|
|
1734
|
+
'%I.workspace_learning_policy_get_or_create_snapshot(uuid,uuid,uuid,uuid,uuid,integer)',
|
|
1735
|
+
${literal(schema)}
|
|
1736
|
+
)
|
|
1737
|
+
) IS NOT NULL THEN
|
|
1738
|
+
EXECUTE format(
|
|
1739
|
+
'GRANT EXECUTE ON FUNCTION %I.workspace_learning_policy_get_or_create_snapshot(uuid, uuid, uuid, uuid, uuid, integer) TO %I',
|
|
1740
|
+
${literal(schema)},
|
|
1741
|
+
${literal(role)}
|
|
1742
|
+
);
|
|
1743
|
+
END IF;
|
|
1089
1744
|
IF to_regprocedure(
|
|
1090
1745
|
format(
|
|
1091
1746
|
'%I.scoped_knowledge_apply_lifecycle(uuid,text,uuid,text,bigint,text,text,text,text,text,text)',
|
|
@@ -1098,6 +1753,26 @@ BEGIN
|
|
|
1098
1753
|
${literal(role)}
|
|
1099
1754
|
);
|
|
1100
1755
|
END IF;
|
|
1756
|
+
-- Migration 0197 creates this target-schema-local SECURITY DEFINER lock
|
|
1757
|
+
-- before opengeni_app may exist. Re-converge only its exact EXECUTE grant
|
|
1758
|
+
-- for the supported migrate-then-provision install order; keep PUBLIC
|
|
1759
|
+
-- revoked and do not widen table privileges.
|
|
1760
|
+
IF to_regprocedure(
|
|
1761
|
+
format(
|
|
1762
|
+
'%I.knowledge_source_sync_lock_authority(uuid,uuid,uuid)',
|
|
1763
|
+
${literal(schema)}
|
|
1764
|
+
)
|
|
1765
|
+
) IS NOT NULL THEN
|
|
1766
|
+
EXECUTE format(
|
|
1767
|
+
'REVOKE ALL ON FUNCTION %I.knowledge_source_sync_lock_authority(uuid, uuid, uuid) FROM PUBLIC',
|
|
1768
|
+
${literal(schema)}
|
|
1769
|
+
);
|
|
1770
|
+
EXECUTE format(
|
|
1771
|
+
'GRANT EXECUTE ON FUNCTION %I.knowledge_source_sync_lock_authority(uuid, uuid, uuid) TO %I',
|
|
1772
|
+
${literal(schema)},
|
|
1773
|
+
${literal(role)}
|
|
1774
|
+
);
|
|
1775
|
+
END IF;
|
|
1101
1776
|
IF to_regprocedure(
|
|
1102
1777
|
format(
|
|
1103
1778
|
'%I.scoped_knowledge_advance_source_acl(uuid,uuid,bigint,bigint,uuid,text,text,text,text,text,text)',
|
|
@@ -1153,10 +1828,81 @@ BEGIN
|
|
|
1153
1828
|
EXECUTE format('REVOKE CREATE ON SCHEMA opengeni_private FROM %I', ${literal(role)});
|
|
1154
1829
|
EXECUTE format('GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA opengeni_private TO %I', ${literal(role)});
|
|
1155
1830
|
EXECUTE format(
|
|
1156
|
-
'ALTER DEFAULT PRIVILEGES FOR ROLE %I IN SCHEMA opengeni_private
|
|
1831
|
+
'ALTER DEFAULT PRIVILEGES FOR ROLE %I IN SCHEMA opengeni_private REVOKE EXECUTE ON FUNCTIONS FROM %I',
|
|
1157
1832
|
owner_role,
|
|
1158
1833
|
${literal(role)}
|
|
1159
1834
|
);
|
|
1835
|
+
-- Global cross-workspace artifact workers are separate capabilities. Never
|
|
1836
|
+
-- let the generic tenant-scoped app role inherit them from the historical
|
|
1837
|
+
-- blanket grant of already-installed helpers.
|
|
1838
|
+
IF to_regprocedure('opengeni_private.claim_editable_artifact_live_outbox(text,integer,integer,name)') IS NOT NULL THEN
|
|
1839
|
+
EXECUTE format(
|
|
1840
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.claim_editable_artifact_live_outbox(text, integer, integer, name) FROM %I',
|
|
1841
|
+
${literal(role)}
|
|
1842
|
+
);
|
|
1843
|
+
EXECUTE format(
|
|
1844
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.mark_editable_artifact_live_outbox_published(text, text, integer, name) FROM %I',
|
|
1845
|
+
${literal(role)}
|
|
1846
|
+
);
|
|
1847
|
+
EXECUTE format(
|
|
1848
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.renew_editable_artifact_live_outbox(text, text, integer, integer, name) FROM %I',
|
|
1849
|
+
${literal(role)}
|
|
1850
|
+
);
|
|
1851
|
+
EXECUTE format(
|
|
1852
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.retry_editable_artifact_live_outbox(text, text, integer, integer, text, name) FROM %I',
|
|
1853
|
+
${literal(role)}
|
|
1854
|
+
);
|
|
1855
|
+
EXECUTE format(
|
|
1856
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.dead_letter_editable_artifact_live_outbox(text, text, integer, text, name) FROM %I',
|
|
1857
|
+
${literal(role)}
|
|
1858
|
+
);
|
|
1859
|
+
EXECUTE format(
|
|
1860
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.release_editable_artifact_live_outbox(text, text, integer, name) FROM %I',
|
|
1861
|
+
${literal(role)}
|
|
1862
|
+
);
|
|
1863
|
+
END IF;
|
|
1864
|
+
IF to_regprocedure('opengeni_private.claim_editable_artifact_materializations(text,integer,integer,name)') IS NOT NULL THEN
|
|
1865
|
+
EXECUTE format(
|
|
1866
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.claim_editable_artifact_materializations(text, integer, integer, name) FROM %I',
|
|
1867
|
+
${literal(role)}
|
|
1868
|
+
);
|
|
1869
|
+
EXECUTE format(
|
|
1870
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.renew_editable_artifact_materialization(uuid, uuid, text, text, text, integer, integer, name) FROM %I',
|
|
1871
|
+
${literal(role)}
|
|
1872
|
+
);
|
|
1873
|
+
EXECUTE format(
|
|
1874
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.succeed_editable_artifact_materialization(uuid, uuid, text, text, text, integer, text, text, text, bigint, text, text, timestamptz, name) FROM %I',
|
|
1875
|
+
${literal(role)}
|
|
1876
|
+
);
|
|
1877
|
+
EXECUTE format(
|
|
1878
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.fail_editable_artifact_materialization(uuid, uuid, text, text, text, integer, text, name) FROM %I',
|
|
1879
|
+
${literal(role)}
|
|
1880
|
+
);
|
|
1881
|
+
END IF;
|
|
1882
|
+
IF to_regprocedure('opengeni_private.consume_editable_artifact_live_ticket(text,name)') IS NOT NULL THEN
|
|
1883
|
+
EXECUTE format(
|
|
1884
|
+
'REVOKE EXECUTE ON FUNCTION opengeni_private.resolve_editable_artifact_ticket_data_schema(name) FROM %I',
|
|
1885
|
+
${literal(role)}
|
|
1886
|
+
);
|
|
1887
|
+
EXECUTE format(
|
|
1888
|
+
'GRANT EXECUTE ON FUNCTION opengeni_private.put_editable_artifact_live_ticket(text, uuid, uuid, text, text, text, text, text, text, text, text, integer, text, boolean, integer, timestamptz, timestamptz, name) TO %I',
|
|
1889
|
+
${literal(role)}
|
|
1890
|
+
);
|
|
1891
|
+
EXECUTE format(
|
|
1892
|
+
'GRANT EXECUTE ON FUNCTION opengeni_private.consume_editable_artifact_live_ticket(text, name) TO %I',
|
|
1893
|
+
${literal(role)}
|
|
1894
|
+
);
|
|
1895
|
+
EXECUTE format(
|
|
1896
|
+
'GRANT EXECUTE ON FUNCTION opengeni_private.cleanup_expired_editable_artifact_live_tickets(integer, name) TO %I',
|
|
1897
|
+
${literal(role)}
|
|
1898
|
+
);
|
|
1899
|
+
END IF;
|
|
1900
|
+
IF to_regprocedure('opengeni_private.authorize_editable_artifact_actor(uuid,uuid,text,text,text,text,text,text,integer,text,text,name)') IS NOT NULL THEN
|
|
1901
|
+
EXECUTE format(
|
|
1902
|
+
'GRANT EXECUTE ON FUNCTION opengeni_private.authorize_editable_artifact_actor(uuid, uuid, text, text, text, text, text, text, integer, text, text, name) TO %I',
|
|
1903
|
+
${literal(role)}
|
|
1904
|
+
);
|
|
1905
|
+
END IF;
|
|
1160
1906
|
END IF;
|
|
1161
1907
|
END $$;
|
|
1162
1908
|
`);
|
|
@@ -1195,11 +1941,14 @@ if (import.meta.main) {
|
|
|
1195
1941
|
}
|
|
1196
1942
|
|
|
1197
1943
|
export {
|
|
1944
|
+
RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES,
|
|
1198
1945
|
FORCE_RLS_TABLES,
|
|
1199
1946
|
NON_RLS_RUNTIME_TABLES,
|
|
1200
1947
|
RUNTIME_FULL_DML_TABLES,
|
|
1201
1948
|
RUNTIME_READ_ONLY_TABLES,
|
|
1949
|
+
RUNTIME_READ_UPDATE_TABLES,
|
|
1202
1950
|
RUNTIME_READ_INSERT_TABLES,
|
|
1951
|
+
RUNTIME_READ_INSERT_UPDATE_TABLES,
|
|
1203
1952
|
PROTECTED_NO_DIRECT_DML_TABLES,
|
|
1204
1953
|
RUNTIME_TABLE_PRIVILEGES,
|
|
1205
1954
|
RUNTIME_DML_TABLES,
|
|
@@ -1210,4 +1959,4 @@ export {
|
|
|
1210
1959
|
runtimeDatabaseReadyCheck,
|
|
1211
1960
|
provisionRoles
|
|
1212
1961
|
};
|
|
1213
|
-
//# sourceMappingURL=chunk-
|
|
1962
|
+
//# sourceMappingURL=chunk-YHZXQ7HP.js.map
|