@opengeni/db 0.28.9 → 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-VHBFHMPC.js → chunk-YHZXQ7HP.js} +754 -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/generated-images.d.ts +139 -0
- package/dist/index.d.ts +698 -111
- package/dist/index.js +27573 -10322
- 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/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 +3 -3
- 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 +18342 -9099
- package/dist/schema.js +165 -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 +1 -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.d.ts +2 -2
- 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/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 +427 -23
- 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/generated-images.ts +740 -0
- package/src/index.ts +5917 -1182
- 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/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 +4 -7
- 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 +508 -5
- package/src/schema.ts +5117 -3119
- package/src/scoped-knowledge-schema.ts +1 -1
- package/src/scoped-knowledge.ts +655 -3
- package/src/session-control.ts +8 -5
- package/src/session-queue-commands.ts +187 -14
- package/src/session-realtime-context.ts +2 -2
- package/src/session-realtime-ledger.ts +3 -3
- package/src/session-realtime.ts +7 -7
- package/src/session-tool-call-settlement.ts +9 -0
- package/src/slack-user-link-access.ts +702 -0
- 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-P6CUHXQZ.js +0 -7248
- package/dist/chunk-P6CUHXQZ.js.map +0 -1
- package/dist/chunk-VHBFHMPC.js.map +0 -1
package/src/runtime-posture.ts
CHANGED
|
@@ -6,6 +6,53 @@ import {
|
|
|
6
6
|
type RoleRelationshipCatalogRow,
|
|
7
7
|
} from "./role-relationships";
|
|
8
8
|
|
|
9
|
+
const ARTIFACT_OUTBOX_CAPABILITY_ROUTINES = [
|
|
10
|
+
"claim_editable_artifact_live_outbox(text, integer, integer, name)",
|
|
11
|
+
"mark_editable_artifact_live_outbox_published(text, text, integer, name)",
|
|
12
|
+
"renew_editable_artifact_live_outbox(text, text, integer, integer, name)",
|
|
13
|
+
"retry_editable_artifact_live_outbox(text, text, integer, integer, text, name)",
|
|
14
|
+
"dead_letter_editable_artifact_live_outbox(text, text, integer, text, name)",
|
|
15
|
+
"release_editable_artifact_live_outbox(text, text, integer, name)",
|
|
16
|
+
] as const;
|
|
17
|
+
|
|
18
|
+
const ARTIFACT_MATERIALIZER_CAPABILITY_ROUTINES = [
|
|
19
|
+
"claim_editable_artifact_materializations(text, integer, integer, name)",
|
|
20
|
+
"renew_editable_artifact_materialization(uuid, uuid, text, text, text, integer, integer, name)",
|
|
21
|
+
"succeed_editable_artifact_materialization(uuid, uuid, text, text, text, integer, text, text, text, bigint, text, text, timestamp with time zone, name)",
|
|
22
|
+
"fail_editable_artifact_materialization(uuid, uuid, text, text, text, integer, text, name)",
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
const ARTIFACT_LIVE_TICKET_CAPABILITY_ROUTINES = [
|
|
26
|
+
"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)",
|
|
27
|
+
"consume_editable_artifact_live_ticket(text, name)",
|
|
28
|
+
"cleanup_expired_editable_artifact_live_tickets(integer, name)",
|
|
29
|
+
] as const;
|
|
30
|
+
|
|
31
|
+
const ARTIFACT_LIVE_TICKET_INTERNAL_ROUTINES = [
|
|
32
|
+
"resolve_editable_artifact_ticket_data_schema(name)",
|
|
33
|
+
] as const;
|
|
34
|
+
|
|
35
|
+
const ARTIFACT_AUTHORIZATION_CAPABILITY_ROUTINES = [
|
|
36
|
+
"authorize_editable_artifact_actor(uuid, uuid, text, text, text, text, text, text, integer, text, text, name)",
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
const DEDICATED_ARTIFACT_CAPABILITY_ROUTINES = new Set<string>([
|
|
40
|
+
...ARTIFACT_OUTBOX_CAPABILITY_ROUTINES,
|
|
41
|
+
...ARTIFACT_MATERIALIZER_CAPABILITY_ROUTINES,
|
|
42
|
+
...ARTIFACT_LIVE_TICKET_INTERNAL_ROUTINES,
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE =
|
|
46
|
+
"knowledge_source_sync_lock_authority(uuid, uuid, uuid)";
|
|
47
|
+
const KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES = [
|
|
48
|
+
"knowledge_sources",
|
|
49
|
+
"knowledge_source_objects",
|
|
50
|
+
] as const;
|
|
51
|
+
|
|
52
|
+
export const RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES = [
|
|
53
|
+
KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE,
|
|
54
|
+
] as const;
|
|
55
|
+
|
|
9
56
|
/**
|
|
10
57
|
* The complete standalone tenant-table contract. Adding or removing a
|
|
11
58
|
* FORCE-RLS table is an architectural change: update this list in the same
|
|
@@ -14,17 +61,44 @@ import {
|
|
|
14
61
|
export const FORCE_RLS_TABLES = [
|
|
15
62
|
"agent_run_states",
|
|
16
63
|
"api_keys",
|
|
64
|
+
"attached_browser_devices",
|
|
65
|
+
"attached_browser_inventories",
|
|
17
66
|
"audit_events",
|
|
67
|
+
"auth_runs",
|
|
18
68
|
"billing_customers",
|
|
69
|
+
"browser_identities",
|
|
70
|
+
"browser_revision_components",
|
|
71
|
+
"browser_revisions",
|
|
72
|
+
"browser_session_associations",
|
|
73
|
+
"browser_sessions",
|
|
74
|
+
"browser_state_artifacts",
|
|
75
|
+
"capability_api_facets",
|
|
19
76
|
"capability_catalog_items",
|
|
77
|
+
"capability_component_owners",
|
|
78
|
+
"capability_facet_installations",
|
|
79
|
+
"capability_facets",
|
|
20
80
|
"capability_installations",
|
|
81
|
+
"capability_integration_facets",
|
|
82
|
+
"capability_mcp_facets",
|
|
83
|
+
"capability_operations",
|
|
84
|
+
"capability_plugin_installations",
|
|
85
|
+
"capability_plugin_versions",
|
|
86
|
+
"capability_plugins",
|
|
87
|
+
"capability_skill_facets",
|
|
88
|
+
"capability_skill_files",
|
|
21
89
|
"codex_apps_settings",
|
|
22
90
|
"codex_capacity_waiters",
|
|
23
91
|
"codex_credential_leases",
|
|
24
92
|
"codex_reset_redemption_attempts",
|
|
25
93
|
"codex_rotation_settings",
|
|
26
94
|
"codex_subscription_credentials",
|
|
95
|
+
"company_profile_activation_events",
|
|
96
|
+
"company_profile_heads",
|
|
97
|
+
"company_profile_revisions",
|
|
98
|
+
"company_profile_snapshots",
|
|
27
99
|
"composer_drafts",
|
|
100
|
+
"computer_session_associations",
|
|
101
|
+
"computer_sessions",
|
|
28
102
|
"connection_disconnect_operations",
|
|
29
103
|
"connections",
|
|
30
104
|
"connector_action_policies",
|
|
@@ -34,9 +108,27 @@ export const FORCE_RLS_TABLES = [
|
|
|
34
108
|
"document_bases",
|
|
35
109
|
"document_chunks",
|
|
36
110
|
"documents",
|
|
111
|
+
"editable_artifact_blob_refs",
|
|
112
|
+
"editable_artifact_idempotency_receipts",
|
|
113
|
+
"editable_artifact_live_outbox",
|
|
114
|
+
"editable_artifact_live_tickets",
|
|
115
|
+
"editable_artifact_materialization_jobs",
|
|
116
|
+
"editable_artifact_materialization_results",
|
|
117
|
+
"editable_artifact_operations",
|
|
118
|
+
"editable_artifact_replica_leases",
|
|
119
|
+
"editable_artifact_scope_authorization_heads",
|
|
120
|
+
"editable_artifact_sequence_checkpoints",
|
|
121
|
+
"editable_artifact_session_links",
|
|
122
|
+
"editable_artifact_snapshots",
|
|
123
|
+
"editable_artifact_transactions",
|
|
124
|
+
"editable_artifact_undo_claims",
|
|
125
|
+
"editable_artifact_versions",
|
|
126
|
+
"editable_artifacts",
|
|
37
127
|
"enrollments",
|
|
38
128
|
"file_uploads",
|
|
39
129
|
"files",
|
|
130
|
+
"generated_image_artifacts",
|
|
131
|
+
"generated_video_artifacts",
|
|
40
132
|
"github_installation_repositories",
|
|
41
133
|
"github_installations",
|
|
42
134
|
"host_export_config",
|
|
@@ -44,8 +136,17 @@ export const FORCE_RLS_TABLES = [
|
|
|
44
136
|
"host_export_cursor_state",
|
|
45
137
|
"host_export_dead_letters",
|
|
46
138
|
"host_export_outbox",
|
|
139
|
+
"image_generation_operations",
|
|
47
140
|
"import_batches",
|
|
141
|
+
"integration_feature_binding_owners",
|
|
142
|
+
"integration_feature_bindings",
|
|
143
|
+
"integration_feature_facets",
|
|
48
144
|
"integration_oauth_state_nonces",
|
|
145
|
+
"integration_spec_revisions",
|
|
146
|
+
"integration_tools",
|
|
147
|
+
"interaction_interventions",
|
|
148
|
+
"interaction_operations",
|
|
149
|
+
"interaction_resource_operations",
|
|
49
150
|
"knowledge_change_proposals",
|
|
50
151
|
"knowledge_claim_evidence",
|
|
51
152
|
"knowledge_claim_relations",
|
|
@@ -63,13 +164,23 @@ export const FORCE_RLS_TABLES = [
|
|
|
63
164
|
"knowledge_providers",
|
|
64
165
|
"knowledge_source_acl_versions",
|
|
65
166
|
"knowledge_source_objects",
|
|
167
|
+
"knowledge_source_sync_index_obligations",
|
|
168
|
+
"knowledge_source_sync_item_outcomes",
|
|
169
|
+
"knowledge_source_sync_object_observations",
|
|
170
|
+
"knowledge_source_sync_states",
|
|
171
|
+
"knowledge_source_sync_wakes",
|
|
66
172
|
"knowledge_sources",
|
|
67
173
|
"knowledge_sync_runs",
|
|
68
174
|
"machine_metrics_latest",
|
|
69
175
|
"machine_metrics_series",
|
|
70
176
|
"machine_removal_operations",
|
|
177
|
+
"memory_slack_publication_configurations",
|
|
178
|
+
"memory_slack_publication_receipts",
|
|
179
|
+
"memory_slack_publications",
|
|
71
180
|
"model_call_facts",
|
|
181
|
+
"network_routes",
|
|
72
182
|
"new_session_drafts",
|
|
183
|
+
"pack_installation_components",
|
|
73
184
|
"pack_installations",
|
|
74
185
|
"preference_registry_events",
|
|
75
186
|
"preference_registry_preferences",
|
|
@@ -89,7 +200,9 @@ export const FORCE_RLS_TABLES = [
|
|
|
89
200
|
"sandboxes",
|
|
90
201
|
"scheduled_task_runs",
|
|
91
202
|
"scheduled_tasks",
|
|
203
|
+
"session_attempt_codemode_calls",
|
|
92
204
|
"session_attempt_interruptions",
|
|
205
|
+
"session_attempt_tool_catalogs",
|
|
93
206
|
"session_command_receipts",
|
|
94
207
|
"session_events",
|
|
95
208
|
"session_goals",
|
|
@@ -112,19 +225,26 @@ export const FORCE_RLS_TABLES = [
|
|
|
112
225
|
"session_turns",
|
|
113
226
|
"session_workflow_wake_outbox",
|
|
114
227
|
"sessions",
|
|
228
|
+
"site_auth_connections",
|
|
115
229
|
"slack_bot_delete_operations",
|
|
116
230
|
"slack_bot_post_operations",
|
|
117
231
|
"slack_bot_user_links",
|
|
232
|
+
"slack_installation_bindings",
|
|
118
233
|
"slack_interaction_inbox",
|
|
119
234
|
"slack_interaction_progress_deliveries",
|
|
120
235
|
"slack_interactions",
|
|
236
|
+
"slack_user_link_access_request_operations",
|
|
237
|
+
"slack_user_link_access_requests",
|
|
121
238
|
"social_connections",
|
|
122
239
|
"social_posts",
|
|
240
|
+
"temporal_schedule_cleanup_outbox",
|
|
123
241
|
"transcription_recording_chunks",
|
|
124
242
|
"transcription_recording_objects",
|
|
125
243
|
"transcription_recording_segments",
|
|
126
244
|
"transcription_recordings",
|
|
127
245
|
"usage_events",
|
|
246
|
+
"video_generation_operations",
|
|
247
|
+
"video_generation_references",
|
|
128
248
|
"workspace_artifact_events",
|
|
129
249
|
"workspace_artifact_versions",
|
|
130
250
|
"workspace_artifacts",
|
|
@@ -136,12 +256,19 @@ export const FORCE_RLS_TABLES = [
|
|
|
136
256
|
"workspace_instruction_policy_onboarding_proposals",
|
|
137
257
|
"workspace_instruction_policy_revisions",
|
|
138
258
|
"workspace_instruction_policy_snapshots",
|
|
259
|
+
"workspace_interaction_revisions",
|
|
260
|
+
"workspace_learning_policy_activation_events",
|
|
261
|
+
"workspace_learning_policy_heads",
|
|
262
|
+
"workspace_learning_policy_revisions",
|
|
263
|
+
"workspace_learning_policy_snapshots",
|
|
139
264
|
"workspace_model_policies",
|
|
140
265
|
"workspace_packs",
|
|
141
266
|
"workspace_screenshot_quotas",
|
|
142
267
|
"workspace_session_activity_revisions",
|
|
143
268
|
"workspace_variable_set_variables",
|
|
144
269
|
"workspace_variable_sets",
|
|
270
|
+
"workspace_video_generation_policies",
|
|
271
|
+
"workspace_video_generation_quotas",
|
|
145
272
|
] as const;
|
|
146
273
|
|
|
147
274
|
/**
|
|
@@ -178,8 +305,13 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
178
305
|
"auth_users",
|
|
179
306
|
"auth_verifications",
|
|
180
307
|
"billing_customers",
|
|
308
|
+
"browser_session_associations",
|
|
181
309
|
"capability_catalog_items",
|
|
310
|
+
"capability_component_owners",
|
|
311
|
+
"capability_facet_installations",
|
|
182
312
|
"capability_installations",
|
|
313
|
+
"capability_operations",
|
|
314
|
+
"capability_plugin_installations",
|
|
183
315
|
"codex_apps_settings",
|
|
184
316
|
"codex_capacity_waiters",
|
|
185
317
|
"codex_credential_leases",
|
|
@@ -187,6 +319,7 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
187
319
|
"codex_rotation_settings",
|
|
188
320
|
"codex_subscription_credentials",
|
|
189
321
|
"composer_drafts",
|
|
322
|
+
"computer_session_associations",
|
|
190
323
|
"connection_disconnect_operations",
|
|
191
324
|
"connections",
|
|
192
325
|
"connector_action_policies",
|
|
@@ -196,21 +329,36 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
196
329
|
"document_bases",
|
|
197
330
|
"document_chunks",
|
|
198
331
|
"documents",
|
|
332
|
+
"editable_artifact_replica_leases",
|
|
199
333
|
"enrollments",
|
|
200
334
|
"file_uploads",
|
|
201
335
|
"files",
|
|
336
|
+
"generated_image_artifacts",
|
|
337
|
+
"generated_video_artifacts",
|
|
202
338
|
"github_installation_repositories",
|
|
203
339
|
"github_installations",
|
|
340
|
+
"image_generation_operations",
|
|
204
341
|
"import_batches",
|
|
342
|
+
"integration_feature_binding_owners",
|
|
343
|
+
"integration_feature_bindings",
|
|
205
344
|
"integration_oauth_clients",
|
|
206
345
|
"integration_oauth_state_nonces",
|
|
207
346
|
"knowledge_memories",
|
|
347
|
+
"knowledge_source_sync_index_obligations",
|
|
348
|
+
"knowledge_source_sync_item_outcomes",
|
|
349
|
+
"knowledge_source_sync_object_observations",
|
|
350
|
+
"knowledge_source_sync_states",
|
|
351
|
+
"knowledge_source_sync_wakes",
|
|
208
352
|
"machine_metrics_latest",
|
|
209
353
|
"machine_metrics_series",
|
|
210
354
|
"machine_removal_operations",
|
|
211
355
|
"managed_accounts",
|
|
356
|
+
"memory_slack_publication_configurations",
|
|
357
|
+
"memory_slack_publication_receipts",
|
|
358
|
+
"memory_slack_publications",
|
|
212
359
|
"model_call_facts",
|
|
213
360
|
"new_session_drafts",
|
|
361
|
+
"pack_installation_components",
|
|
214
362
|
"pack_installations",
|
|
215
363
|
"retained_screenshot_artifacts",
|
|
216
364
|
"rig_changes",
|
|
@@ -262,6 +410,8 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
262
410
|
"transcription_recording_segments",
|
|
263
411
|
"transcription_recordings",
|
|
264
412
|
"usage_events",
|
|
413
|
+
"video_generation_operations",
|
|
414
|
+
"video_generation_references",
|
|
265
415
|
"workspace_artifacts",
|
|
266
416
|
"workspace_captures",
|
|
267
417
|
"workspace_control_events",
|
|
@@ -271,25 +421,50 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
271
421
|
"workspace_model_policies",
|
|
272
422
|
"workspace_packs",
|
|
273
423
|
"workspace_screenshot_quotas",
|
|
274
|
-
"workspace_session_activity_revisions",
|
|
275
424
|
"workspace_variable_set_variables",
|
|
276
425
|
"workspace_variable_sets",
|
|
426
|
+
"workspace_video_generation_policies",
|
|
427
|
+
"workspace_video_generation_quotas",
|
|
277
428
|
"workspaces",
|
|
278
429
|
] as const;
|
|
279
430
|
|
|
280
431
|
/** Configuration and lifecycle-owned audit rows are read-only at runtime. */
|
|
281
432
|
export const RUNTIME_READ_ONLY_TABLES = [
|
|
433
|
+
"company_profile_activation_events",
|
|
434
|
+
"company_profile_heads",
|
|
435
|
+
"company_profile_snapshots",
|
|
282
436
|
"knowledge_lifecycle_events",
|
|
283
437
|
"knowledge_memory_lifecycle_events",
|
|
284
438
|
"knowledge_memory_relationships",
|
|
285
439
|
"nested_agent_depth_configuration",
|
|
286
440
|
"preference_registry_events",
|
|
287
441
|
"preference_registry_snapshots",
|
|
442
|
+
"slack_installation_bindings",
|
|
288
443
|
"workspace_instruction_policy_snapshots",
|
|
444
|
+
"workspace_learning_policy_activation_events",
|
|
445
|
+
"workspace_learning_policy_heads",
|
|
446
|
+
"workspace_learning_policy_snapshots",
|
|
289
447
|
] as const;
|
|
290
448
|
|
|
449
|
+
/** Existing runtime authorities that may be observed and advanced, never created or deleted. */
|
|
450
|
+
export const RUNTIME_READ_UPDATE_TABLES = ["workspace_session_activity_revisions"] as const;
|
|
451
|
+
|
|
291
452
|
/** Append-only evidence/revision tables are insertable and queryable, never mutable. */
|
|
292
453
|
export const RUNTIME_READ_INSERT_TABLES = [
|
|
454
|
+
"browser_revision_components",
|
|
455
|
+
"browser_revisions",
|
|
456
|
+
"company_profile_revisions",
|
|
457
|
+
"editable_artifact_blob_refs",
|
|
458
|
+
"editable_artifact_idempotency_receipts",
|
|
459
|
+
"editable_artifact_live_outbox",
|
|
460
|
+
"editable_artifact_materialization_jobs",
|
|
461
|
+
"editable_artifact_materialization_results",
|
|
462
|
+
"editable_artifact_operations",
|
|
463
|
+
"editable_artifact_sequence_checkpoints",
|
|
464
|
+
"editable_artifact_snapshots",
|
|
465
|
+
"editable_artifact_transactions",
|
|
466
|
+
"editable_artifact_undo_claims",
|
|
467
|
+
"editable_artifact_versions",
|
|
293
468
|
"knowledge_change_proposals",
|
|
294
469
|
"knowledge_claim_evidence",
|
|
295
470
|
"knowledge_claim_relations",
|
|
@@ -307,12 +482,48 @@ export const RUNTIME_READ_INSERT_TABLES = [
|
|
|
307
482
|
"knowledge_sync_runs",
|
|
308
483
|
"preference_registry_preferences",
|
|
309
484
|
"preference_registry_revisions",
|
|
485
|
+
"session_attempt_tool_catalogs",
|
|
310
486
|
"session_spawn_denials",
|
|
487
|
+
"slack_user_link_access_request_operations",
|
|
488
|
+
"temporal_schedule_cleanup_outbox",
|
|
311
489
|
"workspace_artifact_events",
|
|
312
490
|
"workspace_artifact_versions",
|
|
313
491
|
"workspace_instruction_policy_activation_events",
|
|
314
492
|
"workspace_instruction_policy_onboarding_proposals",
|
|
315
493
|
"workspace_instruction_policy_revisions",
|
|
494
|
+
"workspace_learning_policy_revisions",
|
|
495
|
+
] as const;
|
|
496
|
+
|
|
497
|
+
/** Durable operation journals are append/read plus claim/settle updates, never deletes. */
|
|
498
|
+
export const RUNTIME_READ_INSERT_UPDATE_TABLES = [
|
|
499
|
+
"attached_browser_devices",
|
|
500
|
+
"attached_browser_inventories",
|
|
501
|
+
"auth_runs",
|
|
502
|
+
"browser_identities",
|
|
503
|
+
"browser_sessions",
|
|
504
|
+
"browser_state_artifacts",
|
|
505
|
+
"capability_api_facets",
|
|
506
|
+
"capability_facets",
|
|
507
|
+
"capability_integration_facets",
|
|
508
|
+
"capability_mcp_facets",
|
|
509
|
+
"capability_plugin_versions",
|
|
510
|
+
"capability_plugins",
|
|
511
|
+
"capability_skill_facets",
|
|
512
|
+
"capability_skill_files",
|
|
513
|
+
"computer_sessions",
|
|
514
|
+
"editable_artifact_session_links",
|
|
515
|
+
"editable_artifacts",
|
|
516
|
+
"integration_feature_facets",
|
|
517
|
+
"integration_spec_revisions",
|
|
518
|
+
"integration_tools",
|
|
519
|
+
"interaction_interventions",
|
|
520
|
+
"interaction_operations",
|
|
521
|
+
"interaction_resource_operations",
|
|
522
|
+
"network_routes",
|
|
523
|
+
"session_attempt_codemode_calls",
|
|
524
|
+
"site_auth_connections",
|
|
525
|
+
"slack_user_link_access_requests",
|
|
526
|
+
"workspace_interaction_revisions",
|
|
316
527
|
] as const;
|
|
317
528
|
|
|
318
529
|
/**
|
|
@@ -320,6 +531,8 @@ export const RUNTIME_READ_INSERT_TABLES = [
|
|
|
320
531
|
* The ordinary application role must have no direct table privileges on them.
|
|
321
532
|
*/
|
|
322
533
|
export const PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
534
|
+
"editable_artifact_live_tickets",
|
|
535
|
+
"editable_artifact_scope_authorization_heads",
|
|
323
536
|
"host_export_config",
|
|
324
537
|
"host_export_consumers",
|
|
325
538
|
"host_export_cursor_state",
|
|
@@ -338,9 +551,18 @@ const FULL_DML_PRIVILEGES = ["SELECT", "INSERT", "UPDATE", "DELETE"] as const;
|
|
|
338
551
|
export const RUNTIME_TABLE_PRIVILEGES: RuntimeTablePrivilegeContract = Object.freeze({
|
|
339
552
|
...Object.fromEntries(RUNTIME_FULL_DML_TABLES.map((table) => [table, FULL_DML_PRIVILEGES])),
|
|
340
553
|
...Object.fromEntries(RUNTIME_READ_ONLY_TABLES.map((table) => [table, ["SELECT"] as const])),
|
|
554
|
+
...Object.fromEntries(
|
|
555
|
+
RUNTIME_READ_UPDATE_TABLES.map((table) => [table, ["SELECT", "UPDATE"] as const]),
|
|
556
|
+
),
|
|
341
557
|
...Object.fromEntries(
|
|
342
558
|
RUNTIME_READ_INSERT_TABLES.map((table) => [table, ["SELECT", "INSERT"] as const]),
|
|
343
559
|
),
|
|
560
|
+
...Object.fromEntries(
|
|
561
|
+
RUNTIME_READ_INSERT_UPDATE_TABLES.map((table) => [
|
|
562
|
+
table,
|
|
563
|
+
["SELECT", "INSERT", "UPDATE"] as const,
|
|
564
|
+
]),
|
|
565
|
+
),
|
|
344
566
|
});
|
|
345
567
|
|
|
346
568
|
/** All tables with any direct runtime DML; retained as the aggregate public contract. */
|
|
@@ -387,6 +609,8 @@ export type RuntimeTablePosture = {
|
|
|
387
609
|
rlsForced: boolean;
|
|
388
610
|
rlsActive: boolean;
|
|
389
611
|
policyCount: number;
|
|
612
|
+
artifactOutboxDispatcherPolicy: boolean;
|
|
613
|
+
artifactMaterializerPolicy: boolean;
|
|
390
614
|
select: boolean;
|
|
391
615
|
insert: boolean;
|
|
392
616
|
update: boolean;
|
|
@@ -400,6 +624,11 @@ export type RuntimeRoutinePosture = {
|
|
|
400
624
|
name: string;
|
|
401
625
|
owner: string;
|
|
402
626
|
execute: boolean;
|
|
627
|
+
securityDefiner: boolean;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
export type RuntimeTargetRoutinePosture = RuntimeRoutinePosture & {
|
|
631
|
+
publicExecute: boolean;
|
|
403
632
|
};
|
|
404
633
|
|
|
405
634
|
export type RuntimeDatabasePosture = {
|
|
@@ -410,6 +639,7 @@ export type RuntimeDatabasePosture = {
|
|
|
410
639
|
ownedSchemas: string[];
|
|
411
640
|
ownedRelations: string[];
|
|
412
641
|
tables: RuntimeTablePosture[];
|
|
642
|
+
targetRoutines: RuntimeTargetRoutinePosture[];
|
|
413
643
|
privateRoutines: RuntimeRoutinePosture[];
|
|
414
644
|
};
|
|
415
645
|
|
|
@@ -520,6 +750,7 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
520
750
|
ownedSchemas: [],
|
|
521
751
|
ownedRelations: [],
|
|
522
752
|
tables: [],
|
|
753
|
+
targetRoutines: [],
|
|
523
754
|
privateRoutines: [],
|
|
524
755
|
};
|
|
525
756
|
}
|
|
@@ -580,6 +811,8 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
580
811
|
rls_forced: boolean;
|
|
581
812
|
rls_active: boolean;
|
|
582
813
|
policy_count: number;
|
|
814
|
+
artifact_outbox_dispatcher_policy: boolean;
|
|
815
|
+
artifact_materializer_policy: boolean;
|
|
583
816
|
can_select: boolean;
|
|
584
817
|
can_insert: boolean;
|
|
585
818
|
can_update: boolean;
|
|
@@ -596,6 +829,16 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
596
829
|
c.relforcerowsecurity as rls_forced,
|
|
597
830
|
row_security_active(c.oid) as rls_active,
|
|
598
831
|
(select count(*)::int from pg_policy policy where policy.polrelid = c.oid) as policy_count,
|
|
832
|
+
exists(
|
|
833
|
+
select 1 from pg_policy policy
|
|
834
|
+
where policy.polrelid = c.oid
|
|
835
|
+
and policy.polname = 'editable_artifact_outbox_dispatcher'
|
|
836
|
+
) as artifact_outbox_dispatcher_policy,
|
|
837
|
+
exists(
|
|
838
|
+
select 1 from pg_policy policy
|
|
839
|
+
where policy.polrelid = c.oid
|
|
840
|
+
and policy.polname = 'editable_artifact_materializer_owner'
|
|
841
|
+
) as artifact_materializer_policy,
|
|
599
842
|
has_table_privilege(current_user, c.oid, 'SELECT') as can_select,
|
|
600
843
|
has_table_privilege(current_user, c.oid, 'INSERT') as can_insert,
|
|
601
844
|
has_table_privilege(current_user, c.oid, 'UPDATE') as can_update,
|
|
@@ -616,6 +859,8 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
616
859
|
rlsForced: row.rls_forced,
|
|
617
860
|
rlsActive: row.rls_active,
|
|
618
861
|
policyCount: row.policy_count,
|
|
862
|
+
artifactOutboxDispatcherPolicy: row.artifact_outbox_dispatcher_policy,
|
|
863
|
+
artifactMaterializerPolicy: row.artifact_materializer_policy,
|
|
619
864
|
select: row.can_select,
|
|
620
865
|
insert: row.can_insert,
|
|
621
866
|
update: row.can_update,
|
|
@@ -625,26 +870,67 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
625
870
|
trigger: row.can_trigger,
|
|
626
871
|
}));
|
|
627
872
|
|
|
873
|
+
const targetRoutines = resultRows<{
|
|
874
|
+
name: string;
|
|
875
|
+
owner: string;
|
|
876
|
+
can_execute: boolean;
|
|
877
|
+
public_execute: boolean;
|
|
878
|
+
security_definer: boolean;
|
|
879
|
+
}>(
|
|
880
|
+
await tx.execute(sql`
|
|
881
|
+
select
|
|
882
|
+
(p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')')::text as name,
|
|
883
|
+
pg_get_userbyid(p.proowner)::text as owner,
|
|
884
|
+
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute,
|
|
885
|
+
exists (
|
|
886
|
+
select 1
|
|
887
|
+
from aclexplode(coalesce(p.proacl, acldefault('f', p.proowner))) acl
|
|
888
|
+
where acl.grantee = 0 and acl.privilege_type = 'EXECUTE'
|
|
889
|
+
) as public_execute,
|
|
890
|
+
p.prosecdef as security_definer
|
|
891
|
+
from pg_proc p
|
|
892
|
+
join pg_namespace n on n.oid = p.pronamespace
|
|
893
|
+
where p.oid = to_regprocedure(
|
|
894
|
+
format(
|
|
895
|
+
'%I.knowledge_source_sync_lock_authority(uuid,uuid,uuid)',
|
|
896
|
+
${targetSchema}::text
|
|
897
|
+
)
|
|
898
|
+
)
|
|
899
|
+
and n.nspname = ${targetSchema}
|
|
900
|
+
and p.prokind in ('f', 'p')
|
|
901
|
+
order by p.proname, pg_catalog.oidvectortypes(p.proargtypes)
|
|
902
|
+
`),
|
|
903
|
+
).map((row) => ({
|
|
904
|
+
name: row.name,
|
|
905
|
+
owner: row.owner,
|
|
906
|
+
execute: row.can_execute,
|
|
907
|
+
publicExecute: row.public_execute,
|
|
908
|
+
securityDefiner: row.security_definer,
|
|
909
|
+
}));
|
|
910
|
+
|
|
628
911
|
const privateRoutines = resultRows<{
|
|
629
912
|
name: string;
|
|
630
913
|
owner: string;
|
|
631
914
|
can_execute: boolean;
|
|
915
|
+
security_definer: boolean;
|
|
632
916
|
}>(
|
|
633
917
|
await tx.execute(sql`
|
|
634
918
|
select
|
|
635
|
-
(p.proname || '(' ||
|
|
919
|
+
(p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')')::text as name,
|
|
636
920
|
pg_get_userbyid(p.proowner)::text as owner,
|
|
637
|
-
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute
|
|
921
|
+
has_function_privilege(current_user, p.oid, 'EXECUTE') as can_execute,
|
|
922
|
+
p.prosecdef as security_definer
|
|
638
923
|
from pg_proc p
|
|
639
924
|
join pg_namespace n on n.oid = p.pronamespace
|
|
640
925
|
where n.nspname = 'opengeni_private'
|
|
641
926
|
and p.prokind in ('f', 'p')
|
|
642
|
-
order by p.proname,
|
|
927
|
+
order by p.proname, pg_catalog.oidvectortypes(p.proargtypes)
|
|
643
928
|
`),
|
|
644
929
|
).map((row) => ({
|
|
645
930
|
name: row.name,
|
|
646
931
|
owner: row.owner,
|
|
647
932
|
execute: row.can_execute,
|
|
933
|
+
securityDefiner: row.security_definer,
|
|
648
934
|
}));
|
|
649
935
|
|
|
650
936
|
return {
|
|
@@ -654,6 +940,7 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
654
940
|
ownedSchemas,
|
|
655
941
|
ownedRelations,
|
|
656
942
|
tables,
|
|
943
|
+
targetRoutines,
|
|
657
944
|
privateRoutines,
|
|
658
945
|
};
|
|
659
946
|
},
|
|
@@ -823,6 +1110,221 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
823
1110
|
if (table.policyCount < 1) violations.push(`table ${tableName} has no RLS policy`);
|
|
824
1111
|
}
|
|
825
1112
|
|
|
1113
|
+
const targetSchemaOwner = posture.schemas.find((schema) => schema.name === targetSchema)?.owner;
|
|
1114
|
+
for (const expectedRoutine of RUNTIME_TARGET_SCHEMA_CAPABILITY_ROUTINES) {
|
|
1115
|
+
const matches = posture.targetRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
1116
|
+
if (matches.length !== 1) {
|
|
1117
|
+
violations.push(
|
|
1118
|
+
`target-schema runtime capability ${expectedRoutine} is missing or ambiguous`,
|
|
1119
|
+
);
|
|
1120
|
+
continue;
|
|
1121
|
+
}
|
|
1122
|
+
const routine = matches[0]!;
|
|
1123
|
+
if (!routine.securityDefiner) {
|
|
1124
|
+
violations.push(`target-schema runtime capability ${routine.name} is not SECURITY DEFINER`);
|
|
1125
|
+
}
|
|
1126
|
+
if (routine.name === KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_ROUTINE) {
|
|
1127
|
+
const missingAuthorityTables = KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES.filter(
|
|
1128
|
+
(tableName) => !tableByName.has(tableName),
|
|
1129
|
+
);
|
|
1130
|
+
if (missingAuthorityTables.length > 0) {
|
|
1131
|
+
violations.push(
|
|
1132
|
+
`target-schema runtime capability ${routine.name} authority tables are missing: ${missingAuthorityTables.join(", ")}`,
|
|
1133
|
+
);
|
|
1134
|
+
} else {
|
|
1135
|
+
const authorityTables = KNOWLEDGE_SOURCE_SYNC_LOCK_AUTHORITY_TABLES.map(
|
|
1136
|
+
(tableName) => tableByName.get(tableName)!,
|
|
1137
|
+
);
|
|
1138
|
+
const authorityOwners = new Set(authorityTables.map((table) => table.owner));
|
|
1139
|
+
if (authorityOwners.size !== 1) {
|
|
1140
|
+
violations.push(
|
|
1141
|
+
`target-schema runtime capability ${routine.name} authority table owners do not match: ${authorityTables.map((table) => `${table.name}=${table.owner}`).join(", ")}`,
|
|
1142
|
+
);
|
|
1143
|
+
} else if (routine.owner !== authorityTables[0]!.owner) {
|
|
1144
|
+
violations.push(
|
|
1145
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match authority table owner ${authorityTables[0]!.owner}`,
|
|
1146
|
+
);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
} else if (targetSchemaOwner && routine.owner !== targetSchemaOwner) {
|
|
1150
|
+
violations.push(
|
|
1151
|
+
`target-schema runtime capability ${routine.name} owner ${routine.owner} does not match schema owner ${targetSchemaOwner}`,
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
if (!routine.execute) {
|
|
1155
|
+
violations.push(`runtime role lacks target-schema capability ${routine.name}`);
|
|
1156
|
+
}
|
|
1157
|
+
if (routine.publicExecute) {
|
|
1158
|
+
violations.push(`PUBLIC has forbidden target-schema capability ${routine.name}`);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
const artifactOutbox = tableByName.get("editable_artifact_live_outbox");
|
|
1163
|
+
if (artifactOutbox) {
|
|
1164
|
+
if (!artifactOutbox.artifactOutboxDispatcherPolicy) {
|
|
1165
|
+
violations.push("table editable_artifact_live_outbox lacks its owner dispatcher RLS policy");
|
|
1166
|
+
}
|
|
1167
|
+
for (const expectedRoutine of ARTIFACT_OUTBOX_CAPABILITY_ROUTINES) {
|
|
1168
|
+
const matches = posture.privateRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
1169
|
+
if (matches.length !== 1) {
|
|
1170
|
+
violations.push(`artifact outbox capability ${expectedRoutine} is missing or ambiguous`);
|
|
1171
|
+
continue;
|
|
1172
|
+
}
|
|
1173
|
+
const routine = matches[0]!;
|
|
1174
|
+
if (!routine.securityDefiner) {
|
|
1175
|
+
violations.push(`artifact outbox capability ${routine.name} is not SECURITY DEFINER`);
|
|
1176
|
+
}
|
|
1177
|
+
if (routine.owner !== artifactOutbox.owner) {
|
|
1178
|
+
violations.push(
|
|
1179
|
+
`artifact outbox capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactOutbox.owner}`,
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1182
|
+
if (routine.execute) {
|
|
1183
|
+
violations.push(
|
|
1184
|
+
`generic runtime role has forbidden global artifact outbox capability ${routine.name}`,
|
|
1185
|
+
);
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
const artifactMaterializationJobs = tableByName.get("editable_artifact_materialization_jobs");
|
|
1191
|
+
if (artifactMaterializationJobs) {
|
|
1192
|
+
for (const tableName of [
|
|
1193
|
+
"editable_artifact_materialization_jobs",
|
|
1194
|
+
"editable_artifact_materialization_results",
|
|
1195
|
+
"editable_artifact_blob_refs",
|
|
1196
|
+
"editable_artifact_sequence_checkpoints",
|
|
1197
|
+
"editable_artifact_versions",
|
|
1198
|
+
"editable_artifact_idempotency_receipts",
|
|
1199
|
+
]) {
|
|
1200
|
+
const table = tableByName.get(tableName);
|
|
1201
|
+
if (table && !table.artifactMaterializerPolicy) {
|
|
1202
|
+
violations.push(`table ${tableName} lacks its owner materializer RLS policy`);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
for (const expectedRoutine of ARTIFACT_MATERIALIZER_CAPABILITY_ROUTINES) {
|
|
1206
|
+
const matches = posture.privateRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
1207
|
+
if (matches.length !== 1) {
|
|
1208
|
+
violations.push(
|
|
1209
|
+
`artifact materializer capability ${expectedRoutine} is missing or ambiguous`,
|
|
1210
|
+
);
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
const routine = matches[0]!;
|
|
1214
|
+
if (!routine.securityDefiner) {
|
|
1215
|
+
violations.push(`artifact materializer capability ${routine.name} is not SECURITY DEFINER`);
|
|
1216
|
+
}
|
|
1217
|
+
if (routine.owner !== artifactMaterializationJobs.owner) {
|
|
1218
|
+
violations.push(
|
|
1219
|
+
`artifact materializer capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactMaterializationJobs.owner}`,
|
|
1220
|
+
);
|
|
1221
|
+
}
|
|
1222
|
+
if (routine.execute) {
|
|
1223
|
+
violations.push(
|
|
1224
|
+
`generic runtime role has forbidden global artifact materializer capability ${routine.name}`,
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
const artifactAuthority = tableByName.get("editable_artifacts");
|
|
1230
|
+
if (artifactAuthority) {
|
|
1231
|
+
const matches = posture.privateRoutines.filter((routine) =>
|
|
1232
|
+
routine.name.startsWith("advance_editable_artifact_authorization_revision("),
|
|
1233
|
+
);
|
|
1234
|
+
if (matches.length !== 1) {
|
|
1235
|
+
violations.push(
|
|
1236
|
+
"editable artifact authorization revision capability is missing or ambiguous",
|
|
1237
|
+
);
|
|
1238
|
+
} else {
|
|
1239
|
+
const routine = matches[0]!;
|
|
1240
|
+
if (!routine.securityDefiner) {
|
|
1241
|
+
violations.push(
|
|
1242
|
+
`editable artifact authorization revision capability ${routine.name} is not SECURITY DEFINER`,
|
|
1243
|
+
);
|
|
1244
|
+
}
|
|
1245
|
+
if (routine.owner !== artifactAuthority.owner) {
|
|
1246
|
+
violations.push(
|
|
1247
|
+
`editable artifact authorization revision capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactAuthority.owner}`,
|
|
1248
|
+
);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
for (const expectedRoutine of ARTIFACT_AUTHORIZATION_CAPABILITY_ROUTINES) {
|
|
1252
|
+
const capabilityMatches = posture.privateRoutines.filter(
|
|
1253
|
+
(routine) => routine.name === expectedRoutine,
|
|
1254
|
+
);
|
|
1255
|
+
if (capabilityMatches.length !== 1) {
|
|
1256
|
+
violations.push(
|
|
1257
|
+
`editable artifact authorization capability ${expectedRoutine} is missing or ambiguous`,
|
|
1258
|
+
);
|
|
1259
|
+
continue;
|
|
1260
|
+
}
|
|
1261
|
+
const routine = capabilityMatches[0]!;
|
|
1262
|
+
if (!routine.securityDefiner) {
|
|
1263
|
+
violations.push(
|
|
1264
|
+
`editable artifact authorization capability ${routine.name} is not SECURITY DEFINER`,
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1267
|
+
if (routine.owner !== artifactAuthority.owner) {
|
|
1268
|
+
violations.push(
|
|
1269
|
+
`editable artifact authorization capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactAuthority.owner}`,
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
if (!routine.execute) {
|
|
1273
|
+
violations.push(
|
|
1274
|
+
`runtime role lacks editable artifact authorization capability ${routine.name}`,
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
const artifactLiveTickets = tableByName.get("editable_artifact_live_tickets");
|
|
1281
|
+
if (artifactLiveTickets) {
|
|
1282
|
+
for (const expectedRoutine of ARTIFACT_LIVE_TICKET_CAPABILITY_ROUTINES) {
|
|
1283
|
+
const matches = posture.privateRoutines.filter((routine) => routine.name === expectedRoutine);
|
|
1284
|
+
if (matches.length !== 1) {
|
|
1285
|
+
violations.push(
|
|
1286
|
+
`artifact live ticket capability ${expectedRoutine} is missing or ambiguous`,
|
|
1287
|
+
);
|
|
1288
|
+
continue;
|
|
1289
|
+
}
|
|
1290
|
+
const routine = matches[0]!;
|
|
1291
|
+
if (!routine.securityDefiner) {
|
|
1292
|
+
violations.push(`artifact live ticket capability ${routine.name} is not SECURITY DEFINER`);
|
|
1293
|
+
}
|
|
1294
|
+
if (routine.owner !== artifactLiveTickets.owner) {
|
|
1295
|
+
violations.push(
|
|
1296
|
+
`artifact live ticket capability ${routine.name} owner ${routine.owner} does not match table owner ${artifactLiveTickets.owner}`,
|
|
1297
|
+
);
|
|
1298
|
+
}
|
|
1299
|
+
if (!routine.execute) {
|
|
1300
|
+
violations.push(`runtime role lacks artifact live ticket capability ${routine.name}`);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
for (const internalRoutine of ARTIFACT_LIVE_TICKET_INTERNAL_ROUTINES) {
|
|
1304
|
+
const matches = posture.privateRoutines.filter((routine) => routine.name === internalRoutine);
|
|
1305
|
+
if (matches.length !== 1) {
|
|
1306
|
+
violations.push(
|
|
1307
|
+
`artifact live ticket internal routine ${internalRoutine} is missing or ambiguous`,
|
|
1308
|
+
);
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1311
|
+
const routine = matches[0]!;
|
|
1312
|
+
if (!routine.securityDefiner) {
|
|
1313
|
+
violations.push(
|
|
1314
|
+
`artifact live ticket internal routine ${routine.name} is not SECURITY DEFINER`,
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1317
|
+
if (routine.owner !== artifactLiveTickets.owner) {
|
|
1318
|
+
violations.push(
|
|
1319
|
+
`artifact live ticket internal routine ${routine.name} owner ${routine.owner} does not match table owner ${artifactLiveTickets.owner}`,
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
if (routine.execute) {
|
|
1323
|
+
violations.push(`runtime role has forbidden ticket schema resolver ${routine.name}`);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
826
1328
|
if (posture.privateRoutines.length === 0) {
|
|
827
1329
|
violations.push("opengeni_private has no helper routines");
|
|
828
1330
|
}
|
|
@@ -830,7 +1332,8 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
830
1332
|
if (routine.owner === expectedRole) {
|
|
831
1333
|
violations.push(`runtime role owns private routine ${routine.name}`);
|
|
832
1334
|
}
|
|
833
|
-
|
|
1335
|
+
const dedicatedArtifactCapability = DEDICATED_ARTIFACT_CAPABILITY_ROUTINES.has(routine.name);
|
|
1336
|
+
if (!routine.execute && !dedicatedArtifactCapability) {
|
|
834
1337
|
violations.push(`runtime role lacks EXECUTE on private routine ${routine.name}`);
|
|
835
1338
|
}
|
|
836
1339
|
}
|