dcg

Supabase

database.supabase

Protects against destructive Supabase CLI operations including database resets, migration rollbacks, function/secret/storage deletion, project removal, and infrastructure changes

  • 18blocking rules
  • 35safe patterns
  • 6Critical
  • 12High
~/.config/dcg/config.toml
[packs]
enabled = ["database.supabase"]

Evaluated when a command contains supabase, network-restrictions.

Blocking rules

Each rule ID is database.supabase:<name>. Use it in allowlists and [policy.rules].

  1. supabase-db-push

    Critical

    supabase db push applies migrations to the remote database. Use --dry-run to preview first.

    Explanation
    supabase db push applies pending migrations to the remote (linked) database: - Migrations may include DROP/ALTER statements - Changes to the production database are irreversible - With --linked, this targets the live project database Always preview changes first: supabase db push --dry-run Dump remote database before pushing: supabase db dump -f backup.sql --linked
  2. supabase-db-reset

    Critical

    supabase db reset drops and recreates the entire database. All data will be lost.

    Explanation
    supabase db reset completely destroys and recreates your database: - All tables, views, and functions are dropped - All data is permanently deleted - Migrations are re-applied from scratch - Seed data (if configured) is re-inserted This is irreversible for any data not captured in migrations or seeds. With --linked, this targets the remote production database. Before resetting: supabase db dump -f backup.sql Review differences first: supabase db diff
  3. supabase-migration-down

    Critical

    supabase migration down reverts applied migrations. Schema changes and associated data may be lost.

    Explanation
    supabase migration down reverts previously applied migrations: - Reversed migrations may DROP tables, columns, or constraints - Data in dropped objects is permanently lost - With --linked, this targets the remote production database - The --version flag can revert multiple migrations at once Review applied migrations first: supabase migration list Dump the database before reverting: supabase db dump -f backup.sql --linked
  4. supabase-migration-repair

    Critical

    supabase migration repair modifies the migration history. This can cause drift between schema and migrations.

    Explanation
    supabase migration repair alters the migration history table: - Can mark migrations as applied or reverted - May cause schema drift if used incorrectly - Can break future migration runs Review migration status first: supabase migration list Dump the database before repairing: supabase db dump -f backup.sql
  5. supabase-projects-delete

    Critical

    supabase projects delete permanently removes the entire Supabase project and all its data.

    Explanation
    supabase projects delete permanently removes a Supabase project: - The database and all data are deleted - Auth users and sessions are removed - Storage buckets and files are deleted - Edge functions are removed - API keys are invalidated This action cannot be undone. Dump the database before deleting: supabase db dump -f backup.sql --linked Verify the project: supabase projects list
  6. supabase-sso-remove

    Critical

    supabase sso remove disconnects an SSO identity provider. All users authenticating via that provider will be locked out.

    Explanation
    supabase sso remove disconnects an SSO identity provider: - All users authenticating via these providers are immediately locked out - Existing sessions may be invalidated - Re-adding the provider requires full reconfiguration List providers before removing: supabase sso list Inspect provider details: supabase sso show --id {provider_id}
  7. supabase-branches-delete

    High

    supabase branches delete permanently removes a preview branch and its database.

    Explanation
    supabase branches delete permanently removes a preview database branch: - The branch database and all its data are deleted - Any pending migrations on the branch are lost - This action cannot be undone Verify the branch first: supabase branches list Inspect branch details: supabase branches get --id {branch_id}
  8. supabase-config-push

    High

    supabase config push overwrites the remote project configuration with local config.toml settings.

    Explanation
    supabase config push replaces the remote project configuration: - Auth, database, API, and other settings may be overwritten - Misconfiguration can break authentication flows - Changes take effect immediately on the live project Review your local config.toml before pushing.
  9. supabase-db-shell-destructive

    High

    supabase db shell with destructive SQL (DROP/TRUNCATE/DELETE/ALTER). Verify the command carefully.

    Explanation
    supabase db shell is being invoked with destructive SQL: - DROP permanently removes database objects - TRUNCATE removes all rows from tables - DELETE without WHERE removes all rows - ALTER can drop columns, change types, or remove constraints Dump the database before running destructive commands: supabase db dump -f backup.sql Check row count first: supabase db shell -- -c 'SELECT COUNT(*) FROM tablename'
  10. supabase-domains-delete

    High

    supabase domains delete removes the custom domain configuration. Clients using the custom domain will lose access.

    Explanation
    supabase domains delete removes the custom hostname configuration: - Clients accessing the service via the custom domain will fail - DNS records may need to be reconfigured - Re-setup requires DNS verification Check current domain configuration: supabase domains get
  11. supabase-functions-delete

    High

    supabase functions delete removes a deployed Edge Function. This causes immediate downtime for that function.

    Explanation
    supabase functions delete permanently removes a deployed Edge Function: - The function is immediately unavailable - Clients calling the function will receive errors - The function can be re-deployed from local source code Verify the function first: supabase functions list Download source before deleting: supabase functions download {function_name}
  12. supabase-migration-squash

    High

    supabase migration squash consolidates migrations and omits data manipulation statements (INSERT/UPDATE/DELETE).

    Explanation
    supabase migration squash consolidates multiple migration files into one: - DML statements (INSERT, UPDATE, DELETE) are omitted - Cron jobs, storage buckets, and vault secrets are lost - These must be manually recreated in the squashed migration - With --linked, modifies the remote migration history Review migrations before squashing: supabase migration list Dump the database before squashing: supabase db dump -f backup.sql
  13. supabase-network-restrictions-update

    High

    supabase network-restrictions update modifies allowed CIDR ranges. Misconfiguration can lock out all database connections.

    Explanation
    supabase network-restrictions update modifies the database firewall rules: - Overly restrictive CIDR ranges can lock out all connections - Including your own application servers and admin access - Recovery may require Supabase support intervention Check current restrictions first: supabase network-restrictions get
  14. supabase-orgs-delete

    High

    supabase orgs delete permanently removes the organization and may affect all projects within it.

    Explanation
    supabase orgs delete permanently removes an organization: - All projects in the organization may be affected - Billing and subscription are cancelled - Team members lose access This action cannot be undone. List organization projects first: supabase projects list Verify the organization: supabase orgs list
  15. supabase-secrets-unset

    High

    supabase secrets unset removes secrets from the project. Edge Functions depending on them will break immediately.

    Explanation
    supabase secrets unset removes environment variables from the project: - Edge Functions depending on these secrets will fail - Third-party integrations may break - The secret values cannot be retrieved after removal List secrets before removing: supabase secrets list
  16. supabase-stop-no-backup

    High

    supabase stop --no-backup stops the local stack and permanently deletes all data volumes.

    Explanation
    supabase stop --no-backup stops the local development stack and deletes data: - All local database data is permanently deleted - Storage objects in the local stack are removed - Auth users created locally are lost - Combined with --all, deletes ALL local Supabase projects' data Use 'supabase stop' without --no-backup to preserve data.
  17. supabase-storage-rm

    High

    supabase storage rm deletes objects from storage. With --recursive, entire directories are removed.

    Explanation
    supabase storage rm permanently deletes objects from Supabase Storage: - Deleted files cannot be recovered - With --recursive, entire directory trees are removed - User-uploaded content may be permanently lost List contents before deleting: supabase storage ls {path} Copy files locally before deleting: supabase storage cp {path} ./backup/
  18. supabase-vanity-subdomains-delete

    High

    supabase vanity-subdomains delete removes the vanity subdomain. Clients using it will lose access.

    Explanation
    supabase vanity-subdomains delete removes the vanity subdomain: - Clients using the vanity URL will lose access - Auth flows configured with the vanity URL will break - The subdomain name may not be reclaimable Check current configuration: supabase vanity-subdomains get

Safe patterns

Checked first. A command that matches one is never blocked by this pack.

  • supabase-db-diff
  • supabase-db-lint
  • supabase-db-dump
  • supabase-db-shell-safe
  • supabase-inspect-db
  • supabase-status
  • supabase-start
  • supabase-services
  • supabase-gen-types
  • supabase-test-db
  • supabase-migration-list
  • supabase-migration-new
  • supabase-migration-fetch
  • supabase-db-push-dry-run
  • supabase-functions-list
  • supabase-functions-serve
  • supabase-functions-download
  • supabase-functions-new
  • supabase-secrets-list
  • supabase-storage-ls
  • supabase-projects-list
  • supabase-orgs-list
  • supabase-branches-list
  • supabase-branches-get
  • supabase-domains-get
  • supabase-domains-reverify
  • supabase-vanity-subdomains-get
  • supabase-vanity-subdomains-check
  • supabase-sso-list
  • supabase-sso-show
  • supabase-sso-info
  • supabase-network-restrictions-get
  • supabase-network-bans-get
  • supabase-ssl-enforcement-get
  • supabase-postgres-config-get