The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore(hipaa): self-serve PITR (#51342)
K-Dog (Kevin)1da25a7e7291
diff --git a/apps/docs/content/guides/deployment/shared-responsibility-model.mdx b/apps/docs/content/guides/deployment/shared-responsibility-model.mdxindex 7808b3b18c9..055b464d86a 100644--- a/apps/docs/content/guides/deployment/shared-responsibility-model.mdx+++ b/apps/docs/content/guides/deployment/shared-responsibility-model.mdx@@ -95,7 +95,7 @@ You can use Supabase to store and process Protected Health Information (PHI). Yo- [Marking specific projects as HIPAA projects](/docs/guides/platform/hipaa-projects) and addressing security issues raised by the advisor.- Ensuring [MFA is enabled](/docs/guides/platform/multi-factor-authentication) on all Supabase accounts.- [Enforce MFA](/docs/guides/platform/mfa/org-mfa-enforcement) as a requirement to access the organization-- Enabling [Point in Time Recovery](/docs/guides/platform/backups#point-in-time-recovery) which requires at least a [small compute add-on](/docs/guides/platform/compute-and-disk).+- Enabling [Point in Time Recovery](/docs/guides/platform/backups#point-in-time-recovery).- Turning on [SSL Enforcement](/docs/guides/platform/ssl-enforcement).- Enabling [Network Restrictions](/docs/guides/platform/network-restrictions).- Keeping [Postgres connection logging](/docs/guides/platform/postgres-connection-logging) enabled. Supabase sets `log_connections` to off by default for new projects. Projects that need HIPAA compliance should keep connection logging on for audit trails, and the Security Advisor warns if it is disabled.diff --git a/apps/studio/components/interfaces/Settings/Addons/Addons.tsx b/apps/studio/components/interfaces/Settings/Addons/Addons.tsxindex f95b5a80f7e..b5f50619380 100644--- a/apps/studio/components/interfaces/Settings/Addons/Addons.tsx+++ b/apps/studio/components/interfaces/Settings/Addons/Addons.tsx@@ -107,11 +107,14 @@ export const Addons = () => {!projectUpdateDisabled &&(canUpdateIPv4 || ipv4Enabled) &&!isHighAvailability+ // HIPAA projects must have 28-day PITR. Once enabled it is locked; until then it can be enabled.+ const hasHipaaCompliantPitr = pitr?.variant.identifier === 'pitr_28'+ const isPitrLockedByHipaa = hasHipaaAddon && hasHipaaCompliantPitrconst canOpenPITR =isProjectActive &&!projectUpdateDisabled &&sufficientPgVersion &&- !hasHipaaAddon &&+ !isPitrLockedByHipaa &&!isOrioleDbInAws &&!isHighAvailabilityconst canOpenCustomDomain = isProjectActive && !projectUpdateDisabled && !isHighAvailability@@ -128,7 +131,7 @@ export const Addons = () => {const pitrDisabledReason = getPitrDisabledReason({isProjectActive,projectUpdateDisabled,- hasHipaaAddon,+ hasHipaaAddon: isPitrLockedByHipaa,sufficientPgVersion,isOrioleDbInAws,isHighAvailability,@@ -141,6 +144,7 @@ export const Addons = () => {})const pitrAlertState = getPitrAlertState({hasHipaaAddon,+ hasHipaaCompliantPitr,sufficientPgVersion,isOrioleDbInAws,})@@ -157,11 +161,20 @@ export const Addons = () => {<AlertTitle>PITR cannot be changed with HIPAA</AlertTitle><AlertDescription>All projects should have PITR enabled by default and cannot be changed with HIPAA enabled.- Contact support for further assistance.+ </AlertDescription>+ </Alert>+ )+ } else if (pitrAlertState === 'hipaa-non-compliant') {+ pitrAlert = (+ <Alert variant="warning" className="rounded-none border-0 border-b px-6">+ <AlertTitle>Project is not HIPAA compliant</AlertTitle>+ <AlertDescription>+ Projects with HIPAA enabled must have 28 days of PITR. Enable the 28-day PITR add-on to+ make this project compliant.</AlertDescription><div className="mt-4">- <Button asChild>- <SupportLink>Contact support</SupportLink>+ <Button onClick={() => setPanel('pitr')} disabled={!canOpenPITR}>+ Enable 28-day PITR</Button></div></Alert>diff --git a/apps/studio/components/interfaces/Settings/Addons/Addons.utils.test.ts b/apps/studio/components/interfaces/Settings/Addons/Addons.utils.test.tsindex 06bfd537838..ac4be55502d 100644--- a/apps/studio/components/interfaces/Settings/Addons/Addons.utils.test.ts+++ b/apps/studio/components/interfaces/Settings/Addons/Addons.utils.test.ts@@ -233,6 +233,17 @@ describe('getPitrAlertState', () => {).toBe('hipaa')})+ it('returns the non-compliant alert when HIPAA is enabled without 28-day PITR', () => {+ expect(+ getPitrAlertState({+ hasHipaaAddon: true,+ hasHipaaCompliantPitr: false,+ sufficientPgVersion: true,+ isOrioleDbInAws: false,+ })+ ).toBe('hipaa-non-compliant')+ })+it('returns the legacy-project alert when HIPAA is not enabled', () => {expect(getPitrAlertState({diff --git a/apps/studio/components/interfaces/Settings/Addons/Addons.utils.ts b/apps/studio/components/interfaces/Settings/Addons/Addons.utils.tsindex 072d32a7494..def65b0799b 100644--- a/apps/studio/components/interfaces/Settings/Addons/Addons.utils.ts+++ b/apps/studio/components/interfaces/Settings/Addons/Addons.utils.ts@@ -108,18 +108,23 @@ export const getCustomDomainDisabledReason = ({return undefined}-export type PitrAlertState = 'hipaa' | 'legacy-project' | 'orioledb' | undefined+export type PitrAlertState =+ | 'hipaa'+ | 'hipaa-non-compliant'+ | 'legacy-project'+ | 'orioledb'+ | undefinedexport const getPitrAlertState = ({hasHipaaAddon,+ hasHipaaCompliantPitr = true,sufficientPgVersion,isOrioleDbInAws,-}: Pick<- PitrDisabledReasonOptions,- 'hasHipaaAddon' | 'sufficientPgVersion' | 'isOrioleDbInAws'->) => {+}: Pick<PitrDisabledReasonOptions, 'hasHipaaAddon' | 'sufficientPgVersion' | 'isOrioleDbInAws'> & {+ hasHipaaCompliantPitr?: boolean+}): PitrAlertState => {if (hasHipaaAddon) {- return 'hipaa'+ return hasHipaaCompliantPitr ? 'hipaa' : 'hipaa-non-compliant'}if (!sufficientPgVersion) {diff --git a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsxindex 5e36400a1e0..867f1688a22 100644--- a/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx+++ b/apps/studio/components/interfaces/Settings/Addons/PITRSidePanel.tsx@@ -115,6 +115,11 @@ const PITRSidePanel = () => {// If the project is HIPAA, we don't allow the user to downgrade below 28 daysselectedPitr?.identifier !== 'pitr_28')+ // HIPAA projects can't disable PITR, so don't offer the option at all+ const categoryOptions = hasHipaaAddon+ ? PITR_CATEGORY_OPTIONS.filter((option) => option.id !== 'off')+ : PITR_CATEGORY_OPTIONS+const onConfirm = async () => {if (!projectRef) return console.error('Project ref is required')@@ -130,6 +135,9 @@ const PITRSidePanel = () => {if (subscriptionPitr !== undefined) {setSelectedCategory('on')setSelectedOption(subscriptionPitr.variant.identifier)+ } else if (hasHipaaAddon) {+ setSelectedCategory('on')+ setSelectedOption('pitr_28')} else {setSelectedCategory('off')setSelectedOption('pitr_0')@@ -178,7 +186,7 @@ const PITRSidePanel = () => {<div className="mt-8! pb-4"><div className="flex gap-3">- {PITR_CATEGORY_OPTIONS.map((option) => {+ {categoryOptions.map((option) => {const isSelected = selectedCategory === option.idreturn (<div@@ -305,11 +313,12 @@ const PITRSidePanel = () => {/>))}</RadioGroupCard>- <TaxDisclaimer className="mt-3" />++ {availableOptions.some((it) => it.price > 0) && <TaxDisclaimer className="mt-3" />}</div>)}- {hasChanges && selectedOption !== 'pitr_0' && (+ {hasChanges && selectedOption !== 'pitr_0' && selectedPitr?.price !== 0 && (<p className="text-sm text-foreground-light">There are no immediate charges. The add-on is billed at the end of your billing cyclebased on your usage and prorated to the hour.