The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio): clarify RLS disable destructiveness (#46357)
Danny White239825e9a3df
diff --git a/apps/studio/components/interfaces/Database/RLSToggleDialog.tsx b/apps/studio/components/interfaces/Database/RLSToggleDialog.tsxindex 9ad0b7e6ca1..25888e4ce34 100644--- a/apps/studio/components/interfaces/Database/RLSToggleDialog.tsx+++ b/apps/studio/components/interfaces/Database/RLSToggleDialog.tsx@@ -28,20 +28,25 @@ export function RLSToggleDialog({onOpenChange,onConfirm,}: RLSToggleDialogProps) {- const title = isEnabled ? 'Disable Row Level Security' : 'Enable Row Level Security'- const description = isEnabled- ? 'This table will become publicly readable and writable. Anyone can view, add, update, or delete data in this table, and existing RLS policies will no longer apply.'- : 'RLS restricts table access until policies allow a request. Existing queries may stop returning rows until policies are added.'- const confirmLabel = isEnabled ? 'Disable RLS' : 'Enable RLS'- const confirmVariant = isEnabled ? 'danger' : 'primary'-return (<AlertDialog open={open} onOpenChange={onOpenChange}><AlertDialogContent><AlertDialogHeader>- <AlertDialogTitle>{title}</AlertDialogTitle>+ <AlertDialogTitle>+ {isEnabled ? 'Disable Row Level Security' : 'Enable Row Level Security'}+ </AlertDialogTitle><AlertDialogDescription>- {description}{' '}+ {isEnabled ? (+ <>+ This table will become publicly readable and writable.{' '}+ <span className="font-medium text-foreground">+ Anyone can view, add, update, or delete data in this table+ </span>+ , and existing RLS policies will no longer apply.+ </>+ ) : (+ 'RLS restricts table access until policies allow a request. Existing queries may stop returning rows until policies are added.'+ )}{' '}<InlineLink href={`${DOCS_URL}/guides/database/postgres/row-level-security`}>Learn more</InlineLink>@@ -51,11 +56,11 @@ export function RLSToggleDialog({<AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel><AlertDialogAction- variant={confirmVariant}+ variant={isEnabled ? 'danger' : 'primary'}loading={isSubmitting}onClick={() => onConfirm()}>- {confirmLabel}+ {isEnabled ? 'Disable RLS' : 'Enable RLS'}</AlertDialogAction></AlertDialogFooter></AlertDialogContent>diff --git a/e2e/studio/features/rls-policies.spec.ts b/e2e/studio/features/rls-policies.spec.tsindex c7dfb6b3f7d..7b96a968f58 100644--- a/e2e/studio/features/rls-policies.spec.ts+++ b/e2e/studio/features/rls-policies.spec.ts@@ -160,10 +160,17 @@ test.describe('RLS Policies', () => {'RLS disable confirmation modal should appear').toBeVisible({ timeout: 50000 })await expect(- page.getByText(- 'This table will become publicly readable and writable. Anyone can view, add, update, or delete data in this table, and existing RLS policies will no longer apply.'- ),+ page.getByRole('alertdialog'),'RLS disable confirmation should explain the access risk'+ ).toContainText(+ 'This table will become publicly readable and writable. Anyone can view, add, update, or delete data in this table, and existing RLS policies will no longer apply.'+ )+ await expect(+ page+ .getByRole('alertdialog')+ .locator('span.font-medium.text-foreground')+ .filter({ hasText: 'Anyone can view, add, update, or delete data in this table' }),+ 'Key risk phrase should be visually emphasized').toBeVisible()await expect(page.getByRole('alertdialog').getByRole('link', { name: 'Learn more' })