Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/db/drizzle/0000_current_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3403,7 +3403,7 @@ GRANT SELECT(cleanup_not_before) ON TABLE public.v2_artifact_upload_intents TO a
-- Name: COLUMN v2_artifact_upload_intents.quiesced_at; Type: ACL; Schema: public; Owner: -
--

GRANT SELECT(quiesced_at),UPDATE(quiesced_at) ON TABLE public.v2_artifact_upload_intents TO app_agent;
GRANT SELECT(quiesced_at),INSERT(quiesced_at),UPDATE(quiesced_at) ON TABLE public.v2_artifact_upload_intents TO app_agent;
GRANT SELECT(quiesced_at) ON TABLE public.v2_artifact_upload_intents TO app_webhooks;


Expand Down
15 changes: 15 additions & 0 deletions scripts/supabase-target/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function assertSupabaseTarget(client: PgClient): Promise<void> {
await validateRuntimeRoles(client),
await validateRuntimeAcl(client),
await validateImmutableGeneratedOutputAcl(client),
await validateArtifactUploadIntentAcl(client),
await validateDataApiIsolation(client),
await validateIntegrityConstraints(client),
await validateIntegrityIndexes(client),
Expand Down Expand Up @@ -290,6 +291,20 @@ async function validateImmutableGeneratedOutputAcl(client: PgClient): Promise<st
: ["app_agent must not update immutable generated outputs."];
}

async function validateArtifactUploadIntentAcl(client: PgClient): Promise<string[]> {
const result = await client.query(
`select has_column_privilege(pg_catalog.to_regrole('app_agent'), 'public.v2_artifact_upload_intents', 'quiesced_at', 'INSERT') as can_insert_quiesced_at,
has_table_privilege(pg_catalog.to_regrole('app_agent'), 'public.v2_artifact_upload_intents', 'UPDATE') as can_update_table`,
);
const row = result.rows[0];
if (row?.["can_insert_quiesced_at"] !== true) {
return ["app_agent must insert the bounded quiesced-at default on artifact upload intents."];
}
return row["can_update_table"] === false
? []
: ["app_agent must not have table-wide update access to artifact upload intents."];
}

function validateFunctionAcl(
object: string,
privilege: string,
Expand Down