@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
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,17 +164,29 @@ 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",
|
|
176
|
+
"machine_removal_operations",
|
|
177
|
+
"memory_slack_publication_configurations",
|
|
178
|
+
"memory_slack_publication_receipts",
|
|
179
|
+
"memory_slack_publications",
|
|
70
180
|
"model_call_facts",
|
|
181
|
+
"network_routes",
|
|
71
182
|
"new_session_drafts",
|
|
183
|
+
"pack_installation_components",
|
|
72
184
|
"pack_installations",
|
|
73
185
|
"preference_registry_events",
|
|
74
186
|
"preference_registry_preferences",
|
|
75
187
|
"preference_registry_revisions",
|
|
76
188
|
"preference_registry_snapshots",
|
|
189
|
+
"retained_screenshot_artifacts",
|
|
77
190
|
"rig_changes",
|
|
78
191
|
"rig_versions",
|
|
79
192
|
"rigs",
|
|
@@ -87,7 +200,9 @@ export const FORCE_RLS_TABLES = [
|
|
|
87
200
|
"sandboxes",
|
|
88
201
|
"scheduled_task_runs",
|
|
89
202
|
"scheduled_tasks",
|
|
203
|
+
"session_attempt_codemode_calls",
|
|
90
204
|
"session_attempt_interruptions",
|
|
205
|
+
"session_attempt_tool_catalogs",
|
|
91
206
|
"session_command_receipts",
|
|
92
207
|
"session_events",
|
|
93
208
|
"session_goals",
|
|
@@ -110,19 +225,26 @@ export const FORCE_RLS_TABLES = [
|
|
|
110
225
|
"session_turns",
|
|
111
226
|
"session_workflow_wake_outbox",
|
|
112
227
|
"sessions",
|
|
228
|
+
"site_auth_connections",
|
|
113
229
|
"slack_bot_delete_operations",
|
|
114
230
|
"slack_bot_post_operations",
|
|
115
231
|
"slack_bot_user_links",
|
|
232
|
+
"slack_installation_bindings",
|
|
116
233
|
"slack_interaction_inbox",
|
|
117
234
|
"slack_interaction_progress_deliveries",
|
|
118
235
|
"slack_interactions",
|
|
236
|
+
"slack_user_link_access_request_operations",
|
|
237
|
+
"slack_user_link_access_requests",
|
|
119
238
|
"social_connections",
|
|
120
239
|
"social_posts",
|
|
240
|
+
"temporal_schedule_cleanup_outbox",
|
|
121
241
|
"transcription_recording_chunks",
|
|
122
242
|
"transcription_recording_objects",
|
|
123
243
|
"transcription_recording_segments",
|
|
124
244
|
"transcription_recordings",
|
|
125
245
|
"usage_events",
|
|
246
|
+
"video_generation_operations",
|
|
247
|
+
"video_generation_references",
|
|
126
248
|
"workspace_artifact_events",
|
|
127
249
|
"workspace_artifact_versions",
|
|
128
250
|
"workspace_artifacts",
|
|
@@ -134,11 +256,19 @@ export const FORCE_RLS_TABLES = [
|
|
|
134
256
|
"workspace_instruction_policy_onboarding_proposals",
|
|
135
257
|
"workspace_instruction_policy_revisions",
|
|
136
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",
|
|
137
264
|
"workspace_model_policies",
|
|
138
265
|
"workspace_packs",
|
|
266
|
+
"workspace_screenshot_quotas",
|
|
139
267
|
"workspace_session_activity_revisions",
|
|
140
268
|
"workspace_variable_set_variables",
|
|
141
269
|
"workspace_variable_sets",
|
|
270
|
+
"workspace_video_generation_policies",
|
|
271
|
+
"workspace_video_generation_quotas",
|
|
142
272
|
] as const;
|
|
143
273
|
|
|
144
274
|
/**
|
|
@@ -175,8 +305,13 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
175
305
|
"auth_users",
|
|
176
306
|
"auth_verifications",
|
|
177
307
|
"billing_customers",
|
|
308
|
+
"browser_session_associations",
|
|
178
309
|
"capability_catalog_items",
|
|
310
|
+
"capability_component_owners",
|
|
311
|
+
"capability_facet_installations",
|
|
179
312
|
"capability_installations",
|
|
313
|
+
"capability_operations",
|
|
314
|
+
"capability_plugin_installations",
|
|
180
315
|
"codex_apps_settings",
|
|
181
316
|
"codex_capacity_waiters",
|
|
182
317
|
"codex_credential_leases",
|
|
@@ -184,6 +319,7 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
184
319
|
"codex_rotation_settings",
|
|
185
320
|
"codex_subscription_credentials",
|
|
186
321
|
"composer_drafts",
|
|
322
|
+
"computer_session_associations",
|
|
187
323
|
"connection_disconnect_operations",
|
|
188
324
|
"connections",
|
|
189
325
|
"connector_action_policies",
|
|
@@ -193,21 +329,38 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
193
329
|
"document_bases",
|
|
194
330
|
"document_chunks",
|
|
195
331
|
"documents",
|
|
332
|
+
"editable_artifact_replica_leases",
|
|
196
333
|
"enrollments",
|
|
197
334
|
"file_uploads",
|
|
198
335
|
"files",
|
|
336
|
+
"generated_image_artifacts",
|
|
337
|
+
"generated_video_artifacts",
|
|
199
338
|
"github_installation_repositories",
|
|
200
339
|
"github_installations",
|
|
340
|
+
"image_generation_operations",
|
|
201
341
|
"import_batches",
|
|
342
|
+
"integration_feature_binding_owners",
|
|
343
|
+
"integration_feature_bindings",
|
|
202
344
|
"integration_oauth_clients",
|
|
203
345
|
"integration_oauth_state_nonces",
|
|
204
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",
|
|
205
352
|
"machine_metrics_latest",
|
|
206
353
|
"machine_metrics_series",
|
|
354
|
+
"machine_removal_operations",
|
|
207
355
|
"managed_accounts",
|
|
356
|
+
"memory_slack_publication_configurations",
|
|
357
|
+
"memory_slack_publication_receipts",
|
|
358
|
+
"memory_slack_publications",
|
|
208
359
|
"model_call_facts",
|
|
209
360
|
"new_session_drafts",
|
|
361
|
+
"pack_installation_components",
|
|
210
362
|
"pack_installations",
|
|
363
|
+
"retained_screenshot_artifacts",
|
|
211
364
|
"rig_changes",
|
|
212
365
|
"rig_versions",
|
|
213
366
|
"rigs",
|
|
@@ -257,6 +410,8 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
257
410
|
"transcription_recording_segments",
|
|
258
411
|
"transcription_recordings",
|
|
259
412
|
"usage_events",
|
|
413
|
+
"video_generation_operations",
|
|
414
|
+
"video_generation_references",
|
|
260
415
|
"workspace_artifacts",
|
|
261
416
|
"workspace_captures",
|
|
262
417
|
"workspace_control_events",
|
|
@@ -265,25 +420,51 @@ export const RUNTIME_FULL_DML_TABLES = [
|
|
|
265
420
|
"workspace_memberships",
|
|
266
421
|
"workspace_model_policies",
|
|
267
422
|
"workspace_packs",
|
|
268
|
-
"
|
|
423
|
+
"workspace_screenshot_quotas",
|
|
269
424
|
"workspace_variable_set_variables",
|
|
270
425
|
"workspace_variable_sets",
|
|
426
|
+
"workspace_video_generation_policies",
|
|
427
|
+
"workspace_video_generation_quotas",
|
|
271
428
|
"workspaces",
|
|
272
429
|
] as const;
|
|
273
430
|
|
|
274
431
|
/** Configuration and lifecycle-owned audit rows are read-only at runtime. */
|
|
275
432
|
export const RUNTIME_READ_ONLY_TABLES = [
|
|
433
|
+
"company_profile_activation_events",
|
|
434
|
+
"company_profile_heads",
|
|
435
|
+
"company_profile_snapshots",
|
|
276
436
|
"knowledge_lifecycle_events",
|
|
277
437
|
"knowledge_memory_lifecycle_events",
|
|
278
438
|
"knowledge_memory_relationships",
|
|
279
439
|
"nested_agent_depth_configuration",
|
|
280
440
|
"preference_registry_events",
|
|
281
441
|
"preference_registry_snapshots",
|
|
442
|
+
"slack_installation_bindings",
|
|
282
443
|
"workspace_instruction_policy_snapshots",
|
|
444
|
+
"workspace_learning_policy_activation_events",
|
|
445
|
+
"workspace_learning_policy_heads",
|
|
446
|
+
"workspace_learning_policy_snapshots",
|
|
283
447
|
] as const;
|
|
284
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
|
+
|
|
285
452
|
/** Append-only evidence/revision tables are insertable and queryable, never mutable. */
|
|
286
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",
|
|
287
468
|
"knowledge_change_proposals",
|
|
288
469
|
"knowledge_claim_evidence",
|
|
289
470
|
"knowledge_claim_relations",
|
|
@@ -301,12 +482,48 @@ export const RUNTIME_READ_INSERT_TABLES = [
|
|
|
301
482
|
"knowledge_sync_runs",
|
|
302
483
|
"preference_registry_preferences",
|
|
303
484
|
"preference_registry_revisions",
|
|
485
|
+
"session_attempt_tool_catalogs",
|
|
304
486
|
"session_spawn_denials",
|
|
487
|
+
"slack_user_link_access_request_operations",
|
|
488
|
+
"temporal_schedule_cleanup_outbox",
|
|
305
489
|
"workspace_artifact_events",
|
|
306
490
|
"workspace_artifact_versions",
|
|
307
491
|
"workspace_instruction_policy_activation_events",
|
|
308
492
|
"workspace_instruction_policy_onboarding_proposals",
|
|
309
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",
|
|
310
527
|
] as const;
|
|
311
528
|
|
|
312
529
|
/**
|
|
@@ -314,6 +531,8 @@ export const RUNTIME_READ_INSERT_TABLES = [
|
|
|
314
531
|
* The ordinary application role must have no direct table privileges on them.
|
|
315
532
|
*/
|
|
316
533
|
export const PROTECTED_NO_DIRECT_DML_TABLES = [
|
|
534
|
+
"editable_artifact_live_tickets",
|
|
535
|
+
"editable_artifact_scope_authorization_heads",
|
|
317
536
|
"host_export_config",
|
|
318
537
|
"host_export_consumers",
|
|
319
538
|
"host_export_cursor_state",
|
|
@@ -332,9 +551,18 @@ const FULL_DML_PRIVILEGES = ["SELECT", "INSERT", "UPDATE", "DELETE"] as const;
|
|
|
332
551
|
export const RUNTIME_TABLE_PRIVILEGES: RuntimeTablePrivilegeContract = Object.freeze({
|
|
333
552
|
...Object.fromEntries(RUNTIME_FULL_DML_TABLES.map((table) => [table, FULL_DML_PRIVILEGES])),
|
|
334
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
|
+
),
|
|
335
557
|
...Object.fromEntries(
|
|
336
558
|
RUNTIME_READ_INSERT_TABLES.map((table) => [table, ["SELECT", "INSERT"] as const]),
|
|
337
559
|
),
|
|
560
|
+
...Object.fromEntries(
|
|
561
|
+
RUNTIME_READ_INSERT_UPDATE_TABLES.map((table) => [
|
|
562
|
+
table,
|
|
563
|
+
["SELECT", "INSERT", "UPDATE"] as const,
|
|
564
|
+
]),
|
|
565
|
+
),
|
|
338
566
|
});
|
|
339
567
|
|
|
340
568
|
/** All tables with any direct runtime DML; retained as the aggregate public contract. */
|
|
@@ -381,6 +609,8 @@ export type RuntimeTablePosture = {
|
|
|
381
609
|
rlsForced: boolean;
|
|
382
610
|
rlsActive: boolean;
|
|
383
611
|
policyCount: number;
|
|
612
|
+
artifactOutboxDispatcherPolicy: boolean;
|
|
613
|
+
artifactMaterializerPolicy: boolean;
|
|
384
614
|
select: boolean;
|
|
385
615
|
insert: boolean;
|
|
386
616
|
update: boolean;
|
|
@@ -394,6 +624,11 @@ export type RuntimeRoutinePosture = {
|
|
|
394
624
|
name: string;
|
|
395
625
|
owner: string;
|
|
396
626
|
execute: boolean;
|
|
627
|
+
securityDefiner: boolean;
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
export type RuntimeTargetRoutinePosture = RuntimeRoutinePosture & {
|
|
631
|
+
publicExecute: boolean;
|
|
397
632
|
};
|
|
398
633
|
|
|
399
634
|
export type RuntimeDatabasePosture = {
|
|
@@ -404,6 +639,7 @@ export type RuntimeDatabasePosture = {
|
|
|
404
639
|
ownedSchemas: string[];
|
|
405
640
|
ownedRelations: string[];
|
|
406
641
|
tables: RuntimeTablePosture[];
|
|
642
|
+
targetRoutines: RuntimeTargetRoutinePosture[];
|
|
407
643
|
privateRoutines: RuntimeRoutinePosture[];
|
|
408
644
|
};
|
|
409
645
|
|
|
@@ -514,6 +750,7 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
514
750
|
ownedSchemas: [],
|
|
515
751
|
ownedRelations: [],
|
|
516
752
|
tables: [],
|
|
753
|
+
targetRoutines: [],
|
|
517
754
|
privateRoutines: [],
|
|
518
755
|
};
|
|
519
756
|
}
|
|
@@ -574,6 +811,8 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
574
811
|
rls_forced: boolean;
|
|
575
812
|
rls_active: boolean;
|
|
576
813
|
policy_count: number;
|
|
814
|
+
artifact_outbox_dispatcher_policy: boolean;
|
|
815
|
+
artifact_materializer_policy: boolean;
|
|
577
816
|
can_select: boolean;
|
|
578
817
|
can_insert: boolean;
|
|
579
818
|
can_update: boolean;
|
|
@@ -590,6 +829,16 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
590
829
|
c.relforcerowsecurity as rls_forced,
|
|
591
830
|
row_security_active(c.oid) as rls_active,
|
|
592
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,
|
|
593
842
|
has_table_privilege(current_user, c.oid, 'SELECT') as can_select,
|
|
594
843
|
has_table_privilege(current_user, c.oid, 'INSERT') as can_insert,
|
|
595
844
|
has_table_privilege(current_user, c.oid, 'UPDATE') as can_update,
|
|
@@ -610,6 +859,8 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
610
859
|
rlsForced: row.rls_forced,
|
|
611
860
|
rlsActive: row.rls_active,
|
|
612
861
|
policyCount: row.policy_count,
|
|
862
|
+
artifactOutboxDispatcherPolicy: row.artifact_outbox_dispatcher_policy,
|
|
863
|
+
artifactMaterializerPolicy: row.artifact_materializer_policy,
|
|
613
864
|
select: row.can_select,
|
|
614
865
|
insert: row.can_insert,
|
|
615
866
|
update: row.can_update,
|
|
@@ -619,26 +870,67 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
619
870
|
trigger: row.can_trigger,
|
|
620
871
|
}));
|
|
621
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
|
+
|
|
622
911
|
const privateRoutines = resultRows<{
|
|
623
912
|
name: string;
|
|
624
913
|
owner: string;
|
|
625
914
|
can_execute: boolean;
|
|
915
|
+
security_definer: boolean;
|
|
626
916
|
}>(
|
|
627
917
|
await tx.execute(sql`
|
|
628
918
|
select
|
|
629
|
-
(p.proname || '(' ||
|
|
919
|
+
(p.proname || '(' || pg_catalog.oidvectortypes(p.proargtypes) || ')')::text as name,
|
|
630
920
|
pg_get_userbyid(p.proowner)::text as owner,
|
|
631
|
-
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
|
|
632
923
|
from pg_proc p
|
|
633
924
|
join pg_namespace n on n.oid = p.pronamespace
|
|
634
925
|
where n.nspname = 'opengeni_private'
|
|
635
926
|
and p.prokind in ('f', 'p')
|
|
636
|
-
order by p.proname,
|
|
927
|
+
order by p.proname, pg_catalog.oidvectortypes(p.proargtypes)
|
|
637
928
|
`),
|
|
638
929
|
).map((row) => ({
|
|
639
930
|
name: row.name,
|
|
640
931
|
owner: row.owner,
|
|
641
932
|
execute: row.can_execute,
|
|
933
|
+
securityDefiner: row.security_definer,
|
|
642
934
|
}));
|
|
643
935
|
|
|
644
936
|
return {
|
|
@@ -648,6 +940,7 @@ export async function inspectRuntimeDatabasePosture(
|
|
|
648
940
|
ownedSchemas,
|
|
649
941
|
ownedRelations,
|
|
650
942
|
tables,
|
|
943
|
+
targetRoutines,
|
|
651
944
|
privateRoutines,
|
|
652
945
|
};
|
|
653
946
|
},
|
|
@@ -817,6 +1110,221 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
817
1110
|
if (table.policyCount < 1) violations.push(`table ${tableName} has no RLS policy`);
|
|
818
1111
|
}
|
|
819
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
|
+
|
|
820
1328
|
if (posture.privateRoutines.length === 0) {
|
|
821
1329
|
violations.push("opengeni_private has no helper routines");
|
|
822
1330
|
}
|
|
@@ -824,7 +1332,8 @@ export function evaluateRuntimeDatabasePosture(
|
|
|
824
1332
|
if (routine.owner === expectedRole) {
|
|
825
1333
|
violations.push(`runtime role owns private routine ${routine.name}`);
|
|
826
1334
|
}
|
|
827
|
-
|
|
1335
|
+
const dedicatedArtifactCapability = DEDICATED_ARTIFACT_CAPABILITY_ROUTINES.has(routine.name);
|
|
1336
|
+
if (!routine.execute && !dedicatedArtifactCapability) {
|
|
828
1337
|
violations.push(`runtime role lacks EXECUTE on private routine ${routine.name}`);
|
|
829
1338
|
}
|
|
830
1339
|
}
|