Skip to content

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

Only show RLS warnings for tables in the public or user custom schemas

Terry Sutton3f6df8d59416
diff --git a/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx b/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx
index b081c241095..893611cc3ed 100644
--- a/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx
+++ b/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRowHeader.tsx
@@ -2,7 +2,7 @@ import Link from 'next/link'
import { FC } from 'react'
import { useRouter } from 'next/router'
import * as Tooltip from '@radix-ui/react-tooltip'
-import { Badge, Button } from 'ui'
+import { Badge, Button, IconLock } from 'ui'
import type { PostgresTable } from '@supabase/postgres-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { checkPermissions } from 'hooks'
@@ -33,9 +33,17 @@ const PolicyTableRowHeader: FC<Props> = ({
<h4 className="m-0">{table.name}</h4>
</a>
</Link>
- <Badge color={table.rls_enabled ? 'green' : 'yellow'}>
- {table.rls_enabled ? 'RLS enabled' : 'RLS disabled'}
- </Badge>
+ {isLocked ? (
+ <Badge color="scale">
+ <span className="flex gap-2 items-center text-xs uppercase text-scale-900">
+ <IconLock width={12} /> Locked
+ </span>
+ </Badge>
+ ) : (
+ <Badge color={table.rls_enabled ? 'green' : 'yellow'}>
+ {table.rls_enabled ? 'RLS enabled' : 'RLS disabled'}
+ </Badge>
+ )}
</div>
{!isLocked && (
<div className="flex-1">
diff --git a/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx b/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx
index 4b943903e45..70c4b48f9cb 100644
--- a/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx
+++ b/studio/components/interfaces/Auth/Policies/PolicyTableRow/index.tsx
@@ -2,7 +2,6 @@ import { FC } from 'react'
import type { PostgresTable, PostgresPolicy } from '@supabase/postgres-meta'
import { observer } from 'mobx-react-lite'
import { useStore } from 'hooks'
-
import PolicyTableRowHeader from './PolicyTableRowHeader'
import PolicyRow from './PolicyRow'
import Panel from 'components/ui/Panel'
@@ -44,21 +43,22 @@ const PolicyTableRow: FC<Props> = ({
{policies.length === 0 && (
<div className="p-4 px-6 space-y-1">
<p className="text-scale-1100 text-sm">No policies created yet</p>
- {table.rls_enabled ? (
- <p className="text-scale-1000 text-sm">
- RLS is enabled - create a policy to allow access to this table.
- </p>
- ) : (
- <Alert
- withIcon
- variant="warning"
- className="!px-4 !py-3 !mt-3"
- title="Warning: RLS is disabled. Your table is publicly readable and writable."
- >
- Anyone with the anon. key can modify or delete your data. You should turn on RLS and
- create access policies to keep your data secure.
- </Alert>
- )}
+ {!isLocked &&
+ (table.rls_enabled ? (
+ <p className="text-scale-1000 text-sm">
+ RLS is enabled - create a policy to allow access to this table.
+ </p>
+ ) : (
+ <Alert
+ withIcon
+ variant="warning"
+ className="!px-4 !py-3 !mt-3"
+ title="Warning: RLS is disabled. Your table is publicly readable and writable."
+ >
+ Anyone with the anon. key can modify or delete your data. You should turn on RLS and
+ create access policies to keep your data secure.
+ </Alert>
+ ))}
</div>
)}