Skip to content

v2 deploys fail privilege verification: the runtime role holds UPDATE on all of user_type_changes #4318

Closed

Description

@anth-volk

Problem

Since #4297 added user_type_changes, the staging deploy's "Seed staging v2 database / Upgrade schema and seed v2 database" job fails at scripts/reconcile_v2_privileges.py verify (the release run for 43473bb85):

policyengine_v2_runtime holds UPDATE on the whole of user_type_changes, which overrides its declared columns

policyengine_api/data/v2/privileges.py lets the runtime role update only dismissed_at on that table. But each Supabase project's default privileges give policyengine_v2_runtime SELECT, INSERT, UPDATE and DELETE on every table policyengine_v2_migrator creates, so the new table starts with UPDATE on every column. apply reports that privilege under "Privileges the manifest doesn't declare (reported, not revoked)" and never revokes it, so verify fails, and every later deploy fails the same way. Production hasn't run this upgrade yet; its first deploy would fail the same way.

user_type_changes is the first table where the manifest limits the runtime role's UPDATE to named columns. The integration tests didn't catch it, because the disposable test database has no default privileges.

Fix

apply revokes a privilege a role holds directly on a whole table when the manifest declares it for named columns only, then grants the declared columns again in the same transaction.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions