Back to Checks
Prowlerprowler-provider-supabase
Supabase Auth email OTPs and links expire within one hour
auth_email_otp_expiry_limited
Service: authSeverity: low
OfficialVerifiedPrivate
Categories:identity-accessemail-security
Resource Type:SupabaseAuthConfig
Checks that email OTPs and magic links expire within 3600 seconds (one hour), as the Supabase production checklist recommends.
Risk
Long-lived one-time codes and links stay usable for longer after they leak, for example from a forwarded email or a compromised inbox.
Run this check with Prowler
Run in Prowler CloudRun
prowler supabase --checks auth_email_otp_expiry_limitedRecommendation
Set the email OTP expiry to one hour or less.
Remediation
Other
1In the Supabase dashboard, open Authentication > Sign In / Providers > Email
2Set Email OTP Expiration to 3600 seconds or less
3Save
Check Code
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
MAX_EXPIRY_SECONDS = 3600
class auth_email_otp_expiry_limited(Check):
def execute(self) -> list[CheckReportSupabase]:
findings = []
for config in auth_client.auth_configs:
if config.mailer_otp_exp is None:
continue
report = CheckReportSupabase(metadata=self.metadata(), resource=config)
expiry = config.mailer_otp_exp
if expiry <= MAX_EXPIRY_SECONDS:
report.status = "PASS"
report.status_extended = (
f"Project {config.name} email OTPs expire after {expiry} seconds."
)
else:
report.status = "FAIL"
report.status_extended = (
f"Project {config.name} email OTPs expire after {expiry} seconds; "
f"at most {MAX_EXPIRY_SECONDS} are recommended."
)
findings.append(report)
return findings