Skip to content

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

Remove TLE support for table editor (#18687)

Joshen Lim1795966d245c
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
index 9c9d077f593..ac18b77e82d 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
@@ -1,22 +1,16 @@
-import type {
- PostgresColumn,
- PostgresExtension,
- PostgresTable,
- PostgresType,
-} from '@supabase/postgres-meta'
+import type { PostgresColumn, PostgresTable, PostgresType } from '@supabase/postgres-meta'
+import { useParams } from 'common'
import { isEmpty, noop } from 'lodash'
import Link from 'next/link'
import { useEffect, useState } from 'react'
+import { Button, Checkbox, IconExternalLink, IconPlus, Input, SidePanel, Toggle } from 'ui'
-import { useParams } from 'common'
import { Dictionary } from 'components/grid'
-import { EncryptionKeySelector } from 'components/interfaces/Settings/Vault'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms'
import { useForeignKeyConstraintsQuery } from 'data/database/foreign-key-constraints-query'
import { useStore } from 'hooks'
import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'
-import { Button, Checkbox, IconExternalLink, IconPlus, Input, SidePanel, Toggle } from 'ui'
import { ForeignKeySelector } from '..'
import ActionBar from '../ActionBar'
import { TEXT_TYPES } from '../SidePanelEditor.constants'
@@ -50,9 +44,6 @@ export interface ColumnEditorProps {
isNewRecord: boolean,
configuration: {
columnId: string | undefined
- isEncrypted: boolean
- keyId?: string
- keyName?: string
},
resolve: any
) => void
@@ -85,11 +76,6 @@ const ColumnEditor = ({
const keys = vault.listKeys()
const enumTypes = meta.types.list((type: PostgresType) => !EXCLUDED_SCHEMAS.includes(type.schema))
- const [pgsodiumExtension] = meta.extensions.list(
- (ext: PostgresExtension) => ext.name.toLowerCase() === 'pgsodium'
- )
- const isPgSodiumInstalled = pgsodiumExtension?.installed_version !== null
-
const isNewRecord = column === undefined
const originalForeignKey = column
? getColumnForeignKey(column, selectedTable, foreignKeyMeta)
@@ -166,12 +152,7 @@ const ColumnEditor = ({
const foreignKey = columnFields.foreignKey
? { ...columnFields.foreignKey, source_column_name: columnFields.name }
: undefined
- const configuration = {
- columnId: column?.id,
- isEncrypted: columnFields.isEncrypted,
- keyId: columnFields.keyId,
- keyName: columnFields.keyName,
- }
+ const configuration = { columnId: column?.id }
saveChanges(payload, foreignKey, isNewRecord, configuration, resolve)
} else {
resolve()
@@ -357,62 +338,6 @@ const ColumnEditor = ({
/>
</FormSectionContent>
</FormSection>
- {isNewRecord && (
- <>
- <SidePanel.Separator />
- <FormSection
- header={<FormSectionLabel className="lg:!col-span-4">Security</FormSectionLabel>}
- >
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Toggle
- label="Encrypt Column"
- error={errors?.isEncrypted}
- disabled={!isPgSodiumInstalled}
- // @ts-ignore
- descriptionText={
- <div className="space-y-2">
- <p>
- Encrypt the column's data with pgsodium's Transparent Column Encryption (TCE).
- Decrypted values will be stored within the "decrypted_{selectedTable.name}"
- view.
- </p>
- {!isPgSodiumInstalled ? (
- <p>
- You will need to{' '}
- <Link
- href={`/project/${ref}/database/extensions?filter=pgsodium`}
- className="text-brand-300 hover:text-brand transition"
- >
- install
- </Link>{' '}
- the extension <code className="text-xs">pgsodium</code> first before being
- able to encrypt your column.
- </p>
- ) : (
- <p>
- Note: Only columns of <code className="text-xs">text</code> type can be
- encrypted.
- </p>
- )}
- </div>
- }
- checked={columnFields.isEncrypted}
- onChange={() => onUpdateField({ isEncrypted: !columnFields.isEncrypted })}
- />
- {columnFields.isEncrypted && (
- <EncryptionKeySelector
- label="Select a key to encrypt your column with"
- error={errors?.keyName}
- selectedKeyId={columnFields.keyId}
- onSelectKey={(id) => onUpdateField({ keyId: id })}
- onUpdateDescription={(name) => onUpdateField({ keyName: name })}
- />
- )}
- </FormSectionContent>
- </FormSection>
- </>
- )}
-
<ForeignKeySelector
column={columnFields}
visible={isEditingRelation}
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
index 7b4887f3995..9f185b63b60 100644
--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
@@ -36,7 +36,6 @@ export interface SidePanelEditorProps {
// Because the panel is shared between grid editor and database pages
// Both require different responses upon success of these events
onTableCreated?: (table: PostgresTable) => void
- onColumnSaved?: (hasEncryptedColumns?: boolean) => void
}
const SidePanelEditor = ({
@@ -45,7 +44,6 @@ const SidePanelEditor = ({
onRowCreated = noop,
onRowUpdated = noop,
onTableCreated = noop,
- onColumnSaved = noop,
}: SidePanelEditorProps) => {
const snap = useTableEditorStateSnapshot()
const [_, setParams] = useUrlState({ arrayKeys: ['filter', 'sort'] })
@@ -221,18 +219,17 @@ const SidePanelEditor = ({
payload: CreateColumnPayload | UpdateColumnPayload,
foreignKey: ExtendedPostgresRelationship | undefined,
isNewRecord: boolean,
- configuration: { columnId?: string; isEncrypted: boolean; keyId?: string; keyName?: string },
+ configuration: { columnId?: string },
resolve: any
) => {
const selectedColumnToEdit = snap.sidePanel?.type === 'column' && snap.sidePanel.column
- const { columnId, ...securityConfig } = configuration
+ const { columnId } = configuration
const response = isNewRecord
? await meta.createColumn(
payload as CreateColumnPayload,
selectedTable as PostgresTable,
- foreignKey,
- securityConfig
+ foreignKey
)
: await meta.updateColumn(
columnId as string,
@@ -268,15 +265,10 @@ const SidePanelEditor = ({
),
queryClient.invalidateQueries(entityTypeKeys.list(project?.ref)),
])
- onColumnSaved(configuration.isEncrypted)
setIsEdited(false)
snap.closeSidePanel()
}
- if (configuration.isEncrypted && selectedTable?.schema) {
- await meta.views.loadBySchema(selectedTable.schema)
- }
-
resolve()
}
diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
index ef2a0b1c97b..8797b9a1d1c 100644
--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
@@ -223,10 +223,6 @@ const TableGridEditor = ({
if (gridRef.current) gridRef.current.rowEdited(row, idx)
}
- const onColumnSaved = (hasEncryptedColumns = false) => {
- if (hasEncryptedColumns) getEncryptedColumns(selectedTable)
- }
-
const onTableCreated = (table: PostgresTable) => {
router.push(`/project/${projectRef}/editor/${table.id}`)
}
@@ -396,7 +392,6 @@ const TableGridEditor = ({
selectedTable={selectedTable as PostgresTable}
onRowCreated={onRowCreated}
onRowUpdated={onRowUpdated}
- onColumnSaved={onColumnSaved}
onTableCreated={onTableCreated}
/>
)}
diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.ts
index 291330e7731..4ffa8eee86b 100644
--- a/studio/stores/pgmeta/MetaStore.ts
+++ b/studio/stores/pgmeta/MetaStore.ts
@@ -96,8 +96,7 @@ export interface IMetaStore {
createColumn: (
payload: CreateColumnPayload,
selectedTable: PostgresTable,
- foreignKey?: ExtendedPostgresRelationship,
- securityConfiguration?: { isEncrypted: boolean; keyId?: string; keyName?: string }
+ foreignKey?: ExtendedPostgresRelationship
) => any
updateColumn: (
id: string,
@@ -391,8 +390,7 @@ export default class MetaStore implements IMetaStore {
async createColumn(
payload: CreateColumnPayload,
selectedTable: PostgresTable,
- foreignKey?: ExtendedPostgresRelationship,
- securityConfiguration?: { isEncrypted: boolean; keyId?: string; keyName?: string }
+ foreignKey?: ExtendedPostgresRelationship
) {
const toastId = this.rootStore.ui.setNotification({
category: 'loading',
@@ -435,24 +433,6 @@ export default class MetaStore implements IMetaStore {
if (relation.error) throw relation.error
}
- const { isEncrypted, keyId, keyName } = securityConfiguration || {}
- if (isEncrypted) {
- this.rootStore.ui.setNotification({
- id: toastId,
- category: 'loading',
- message: 'Encrypting column...',
- })
- let encryptionKey = keyId
- if (keyId === 'create-new') {
- const addKeyRes = await this.rootStore.vault.addKey(keyName)
- if (addKeyRes.error) throw addKeyRes.error
- else encryptionKey = addKeyRes[0].id
- }
- if (encryptionKey !== undefined) {
- const encryptColumnRes = await this.rootStore.vault.encryptColumn(column, encryptionKey)
- if (encryptColumnRes.error) throw encryptColumnRes.error
- }
- }
this.rootStore.ui.setNotification({
id: toastId,
category: 'success',