Back to Checks
supabase

Supabase RLS policy does not rely on user-editable metadata

database_rls_policy_no_user_metadata
Service: databaseSeverity: high
OfficialVerifiedPrivate
Categories:privilege-escalation
Resource Type:SupabaseDatabaseObject

Reports RLS policies that reference user_metadata from the JWT, which users can edit themselves, as found by the Security Advisor (lint rls_references_user_metadata).

Prowler logoProwlerprowler-provider-supabase

Risk

Users can change their own user_metadata. A policy that trusts it lets any user grant themselves access to rows the policy meant to protect.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler supabase --checks database_rls_policy_no_user_metadata

Recommendation

Base authorization on app_metadata, which only the service role can change, or on database tables, never on user_metadata.

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_rls_policy_no_user_metadata(Check):
    def execute(self) -> list[CheckReportSupabase]:
        return security_lint_findings(self, database_client)