Back to Checks
supabase

Supabase materialized view is not exposed through the Data API

database_materialized_view_not_exposed
Service: databaseSeverity: medium
OfficialVerifiedPrivate
Categories:internet-exposed
Resource Type:SupabaseDatabaseObject

Reports materialized views that the anon or authenticated roles can select through the Data API, as found by the Security Advisor (lint materialized_view_in_api).

Risk

Materialized views do not support RLS. One exposed through the Data API returns all of its rows to anyone holding the public API key.

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_materialized_view_not_exposed

Recommendation

Move the materialized view to a schema the Data API does not expose, or revoke select from the anon and authenticated roles.

Remediation

Other

1In the Supabase dashboard, open the project
2Go to Advisors > Security Advisor
3Open the issue and follow its remediation
4Rerun the advisor to confirm the issue is gone

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.database.database_security_advisor import (
    security_lint_findings,
)


class database_materialized_view_not_exposed(Check):
    def execute(self) -> list[CheckReportSupabase]:
        return security_lint_findings(self, database_client)