Back to Checks
supabase

Supabase Auth redirect URLs are restricted

auth_redirect_urls_restricted
Service: authSeverity: medium
OfficialVerifiedPrivate
Categories:identity-accesstrust-boundaries
Resource Type:SupabaseAuthConfig

Checks that the Auth redirect allow list has no ** wildcards and that the site URL uses https and is not localhost.

Prowler logoProwlerprowler-provider-supabase

Risk

A broad redirect allow list lets an attacker send magic links, OAuth and password reset flows to a site they control and steal the user's session tokens.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler supabase --checks auth_redirect_urls_restricted

Recommendation

List exact redirect URLs and set an https production site URL.

Remediation

Other

1In the Supabase dashboard, open Authentication > URL Configuration
2Set Site URL to your production https URL
3Replace wildcard redirect URLs with exact URLs
4Save

Check Code

from urllib.parse import urlsplit

from prowler.lib.check.models import Check

from prowler_provider_supabase.check_report import CheckReportSupabase
from prowler_provider_supabase.services.auth.auth_client import auth_client

LOCAL_HOSTS = {"localhost", "127.0.0.1"}


class auth_redirect_urls_restricted(Check):
    def execute(self) -> list[CheckReportSupabase]:
        findings = []
        for config in auth_client.auth_configs:
            if not config.has("uri_allow_list", "site_url"):
                continue
            report = CheckReportSupabase(metadata=self.metadata(), resource=config)
            problems = [
                f"redirect URL {url} uses a ** wildcard"
                for url in (
                    url.strip() for url in (config.uri_allow_list or "").split(",")
                )
                if "**" in url
            ]
            site_url = urlsplit(config.site_url or "")
            if site_url.scheme != "https":
                problems.append(f"site URL '{config.site_url or ''}' is not https")
            if site_url.hostname in LOCAL_HOSTS:
                problems.append(f"site URL '{config.site_url}' points to localhost")
            if not problems:
                report.status = "PASS"
                report.status_extended = (
                    f"Project {config.name} restricts Auth redirects to exact URLs "
                    "and an https site URL."
                )
            else:
                report.status = "FAIL"
                report.status_extended = (
                    f"Project {config.name} Auth redirects are too broad: "
                    f"{'; '.join(problems)}."
                )
            findings.append(report)
        return findings