Back to Checks
Supabase database function has a fixed search_path
database_function_search_path_set
Service: databaseSeverity: medium
OfficialVerifiedPrivate
Categories:privilege-escalation
Resource Type:SupabaseDatabaseObject
Reports functions that do not set a fixed search_path, as found by the Security Advisor (lint function_search_path_mutable).
Risk
A function without a fixed search_path resolves names through the caller's search_path. A user who can create objects in an earlier schema can make the function run their code, with the function owner's rights if it is security definer.
Run this check with Prowler
Run in Prowler CloudInstall
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_function_search_path_setRecommendation
Set an explicit search_path on every function, for example ALTER FUNCTION ... SET search_path = ''; and qualify the objects it uses with their schema.
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_function_search_path_set(Check):
def execute(self) -> list[CheckReportSupabase]:
return security_lint_findings(self, database_client)