Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Merge branch 'master' into chore/update-rls-warnings

Terry Suttond6f260bd0d47
diff --cc studio/components/grid/components/header/RLSBannerWarning.tsx
index 28fabaecc1e,e1fdeb35f48..f97439c9c90
--- a/studio/components/grid/components/header/RLSBannerWarning.tsx
+++ b/studio/components/grid/components/header/RLSBannerWarning.tsx
@@@ -1,15 -1,8 +1,16 @@@
import { useState } from 'react'
-import { Button, IconAlertCircle, IconExternalLink, Modal } from 'ui'
+import {
+ Alert,
+ Button,
+ IconAlertCircle,
+ IconBookOpen,
+ IconExternalLink,
+ IconUnlock,
+ Modal,
+} from 'ui'
import Link from 'next/link'
- import { useParams, useStore } from 'hooks'
+ import { useStore } from 'hooks'
+ import { useParams } from 'common/hooks'
import ConfirmationModal from 'components/ui/ConfirmationModal'
import type { PostgresTable } from '@supabase/postgres-meta'
@@@ -66,42 -59,20 +67,41 @@@ export default function RLSBannerWarnin
onSelectConfirm={handleDismissWarning}
children={
<Modal.Content>
- <div className="mt-4 mb-6 space-y-4">
- <p className="text-sm text-scale-1100">
- Data in this table is publicly <u>readable and writable</u> by anyone with the
- anon key. We strongly recommend creating RLS (Row-Level Security) policies to
- allow access to this table.
- </p>
+ <div className="flex gap-4 my-6">
<div>
- <Link href="https://supabase.com/docs/guides/auth/row-level-security">
- <a target="_blank">
- <Button type="default" icon={<IconExternalLink strokeWidth={1.5} />}>
- About RLS Policies
- </Button>
- </a>
- </Link>
+ <div className="w-16 h-16 bg-scale-300 flex flex-col justify-center text-center items-center rounded-full">
+ <IconUnlock strokeWidth={2} size={24} />
+ </div>
+ </div>
+ <div className="text-sm text-scale-1100 grid gap-4">
+ <div className="grid gap-1">
+ <p>
+ Row Level Security will be turned <u>off</u> for this table.
+ </p>
+
+ <Alert
+ variant="warning"
+ className="!px-4 !py-3 mt-3"
+ title=" You are allowing anonymous access to your table"
+ >
+ <p>
+ Anyone with the anon key can modify or delete data. <br />
+ We recommend using RLS policies to control access to your data.
+ </p>
+ </Alert>
+ </div>
+
+ <div className="mt-3">
- <p>Learn more about RLS:</p>
+ <p className="mt-2">
+ <Link href="https://supabase.com/docs/guides/auth/row-level-security">
+ <a target="_blank">
+ <Button type="default" icon={<IconBookOpen strokeWidth={1.5} />}>
- RLS Documentation
++ Learn more about RLS
+ </Button>
+ </a>
+ </Link>
+ </p>
+ </div>
</div>
</div>
</Modal.Content>
diff --cc studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
index 1123665af4f,7f0c9ad1464..b346ae49bf9
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
@@@ -1,17 -1,7 +1,18 @@@
+ import Link from 'next/link'
import { FC, useEffect, useState } from 'react'
import { isUndefined, isEmpty } from 'lodash'
-import { Badge, Checkbox, SidePanel, Input, Alert, IconBookOpen, Button } from 'ui'
+import {
+ Badge,
+ Checkbox,
+ SidePanel,
+ Input,
+ Alert,
+ IconBookOpen,
+ Button,
+ Modal,
+ IconLock,
+ IconUnlock,
+} from 'ui'
import type { PostgresTable, PostgresType } from '@supabase/postgres-meta'
import { useStore } from 'hooks'
@@@ -30,8 -20,6 +31,7 @@@ import
} from './TableEditor.utils'
import { useForeignKeyConstraintsQuery } from 'data/database/foreign-key-constraints-query'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
- import Link from 'next/link'
+import ConfirmationModal from 'components/ui/ConfirmationModal'
interface Props {
table?: PostgresTable
@@@ -343,60 -326,6 +343,59 @@@ const TableEditor: FC<Props> = (
}}
closePanel={() => setIsImportingSpreadsheet(false)}
/>
+
+ <ConfirmationModal
+ visible={rlsConfirmVisible}
+ header="Confirm"
+ buttonLabel="Confirm"
+ size="medium"
+ onSelectCancel={() => setRlsConfirmVisible(false)}
+ onSelectConfirm={() => {
+ onUpdateField({ isRLSEnabled: !tableFields.isRLSEnabled })
+ setRlsConfirmVisible(false)
+ }}
+ children={
+ <Modal.Content>
+ <div className="flex gap-4 my-6">
+ <div>
+ <div className="w-16 h-16 bg-scale-300 flex flex-col justify-center text-center items-center rounded-full">
+ <IconUnlock strokeWidth={2} size={24} />
+ </div>
+ </div>
+ <div className="text-sm text-scale-1100 grid gap-4">
+ <div className="grid gap-1">
+ <p>
+ Row Level Security will be turned <u>off</u> for this table.
+ </p>
+
+ <Alert
+ variant="warning"
+ className="!px-4 !py-3 mt-3"
+ title=" You are allowing anonymous access to your table"
+ >
+ <p>
+ Anyone with the anon key can modify or delete data. <br />
+ We recommend using RLS policies to control access to your data.
+ </p>
+ </Alert>
+ </div>
+
+ <div className="mt-3">
- <p>Learn more about RLS:</p>
+ <p className="mt-2">
+ <Link href="https://supabase.com/docs/guides/auth/row-level-security">
+ <a target="_blank">
+ <Button type="default" icon={<IconBookOpen strokeWidth={1.5} />}>
- RLS Documentation
++ Learn more about RLS
+ </Button>
+ </a>
+ </Link>
+ </p>
+ </div>
+ </div>
+ </div>
+ </Modal.Content>
+ }
+ />
</div>
</SidePanel.Content>
</>