Back to Checks
supabase

Supabase project has point-in-time recovery enabled

database_pitr_enabled
Service: databaseSeverity: medium
OfficialVerifiedPrivate
Categories:resilience
Resource Type:SupabaseProject

Checks that point-in-time recovery (PITR) is enabled, so the database can be restored to any moment in the retention window instead of only to the last daily backup.

Risk

Without PITR, a destructive query, a bug or ransomware can lose up to a day of data, because daily backups are the only restore points.

Run this check with Prowler

Run in Prowler Cloud
Install
pip install --extra-index-url https://__token__:${PROWLER_REGISTRY_DOWNLOAD_API_KEY}@registry.prowler.com/simple/ "prowler-provider-supabase[runtime]"
Run
prowler supabase --checks database_pitr_enabled

Recommendation

Enable point-in-time recovery on production projects.

Remediation

Other

1In the Supabase dashboard, open Project Settings > Add-ons
2Enable Point in time recovery and pick a retention period
3PITR needs at least the Small compute add-on

Check Code

from prowler.lib.check.models import Check

from prowler_provider_supabase.check_report import CheckReportSupabase
from prowler_provider_supabase.services.database.database_client import database_client
from prowler_provider_supabase.services.organization.organization_client import (
    organization_client,
)


class database_pitr_enabled(Check):
    def execute(self) -> list[CheckReportSupabase]:
        findings = []
        for project in database_client.projects:
            if project.ref not in database_client.pitr_enabled:
                continue
            enabled = database_client.pitr_enabled[project.ref]
            # Off on a plan without PITR is not a setting to fix: no finding.
            if (
                not enabled
                and organization_client.entitlements.get("pitr.available_variants")
                is False
            ):
                continue
            report = CheckReportSupabase(metadata=self.metadata(), resource=project)
            if enabled:
                report.status = "PASS"
                report.status_extended = (
                    f"Project {project.name} has point-in-time recovery enabled."
                )
            else:
                report.status = "FAIL"
                report.status_extended = f"Project {project.name} does not have point-in-time recovery enabled."
            findings.append(report)
        return findings