Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat: make dev signup smoke-tests possible without weakening prod (#63317)

Raúl Negrón-Oterof1b85e92c333
diff --git a/posthog/api/signup.py b/posthog/api/signup.py
index ade2ffad1bf3..0a943703193d 100644
--- a/posthog/api/signup.py
+++ b/posthog/api/signup.py
@@ -186,7 +186,10 @@ class SignupSerializer(serializers.Serializer):
return value
def is_email_auto_verified(self):
- return self.is_social_signup
+ if self.is_social_signup:
+ return True
+ domain = self.validated_data.get("email", "").split("@")[-1].lower()
+ return domain in settings.EMAIL_VERIFICATION_SKIP_FOR_DOMAINS
def create(self, validated_data, **kwargs):
if settings.DEMO:
diff --git a/posthog/rate_limit.py b/posthog/rate_limit.py
index bf93c48207d7..0e12e32644cf 100644
--- a/posthog/rate_limit.py
+++ b/posthog/rate_limit.py
@@ -323,7 +323,7 @@ class SignupIPThrottle(IPThrottle):
"""
scope = "signup_ip"
- rate = "5/day"
+ rate = settings.SIGNUP_IP_THROTTLE_RATE
class WebAuthnSignupRegistrationThrottle(IPThrottle):
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index dd9b8b23c075..c42599ce4c13 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -377,6 +377,17 @@ def static_varies_origin(headers, path, url):
WHITENOISE_ADD_HEADERS_FUNCTION = static_varies_origin
+# Per-IP signup throttle rate (see posthog.rate_limit.SignupIPThrottle). Overridable per-env so
+# non-prod (e.g. dev deploy smoke-tests) can raise it without weakening the prod default.
+SIGNUP_IP_THROTTLE_RATE = get_from_env("SIGNUP_IP_THROTTLE_RATE", "5/day")
+
+# Email domains whose signups are created already-verified (skipping the email round-trip), so
+# non-prod deploy smoke-tests can sign up and act immediately. Empty by default — prod verifies
+# every signup.
+EMAIL_VERIFICATION_SKIP_FOR_DOMAINS = [
+ domain.lower() for domain in get_list(get_from_env("EMAIL_VERIFICATION_SKIP_FOR_DOMAINS", ""))
+]
+
####
# REST framework