: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(security): add the signup_risk exemption surface (#108155)
Yasen2432051c7997
diff --git a/products/security/backend/facade/api.py b/products/security/backend/facade/api.pyindex b25db68c2766..b00ff5cd9903 100644--- a/products/security/backend/facade/api.py+++ b/products/security/backend/facade/api.py@@ -22,7 +22,7 @@ from .enums import Outcome, Surfacelogger = structlog.get_logger(__name__)-_OUTCOME_FOR_MATCH = {Surface.EMAIL_CODE: Outcome.EXEMPT}+_OUTCOME_FOR_MATCH = {Surface.EMAIL_CODE: Outcome.EXEMPT, Surface.SIGNUP_RISK: Outcome.EXEMPT}def decide(subject: contracts.SubjectInput, surface: Surface) -> contracts.Decision:@@ -55,6 +55,16 @@ def is_email_code_exempt(email: str) -> bool:return False+def is_signup_risk_exempt(email: str) -> bool:+ """Whether a rule lets this address skip the Radar verdict. Any failure keeps the verdict."""+ try:+ return decide(contracts.SubjectInput(email=email), Surface.SIGNUP_RISK).outcome == Outcome.EXEMPT+ except Exception:+ logger.exception("security_signup_risk_exemption_check_failed")+ DECISION_ERRORS_COUNTER.labels(call_site="signup_risk").inc()+ return False++def shadow_check(subject: contracts.SubjectInput, surface: Surface, *, call_site: str) -> None:"""Records what a block rule would do here, and changes nothing. Never raises."""try:diff --git a/products/security/backend/facade/enums.py b/products/security/backend/facade/enums.pyindex 8d5e90d33e2a..a91d458319d3 100644--- a/products/security/backend/facade/enums.py+++ b/products/security/backend/facade/enums.py@@ -10,10 +10,12 @@ class Surface(StrEnum):APP = "app"AI_GATEWAY = "ai_gateway"EMAIL_CODE = "email_code"+ SIGNUP_RISK = "signup_risk"class Outcome(StrEnum):ALLOW = "allow"BLOCK = "block"- # Only on EMAIL_CODE: the user skips the emailed login code.+ # On EMAIL_CODE the user skips the emailed login code. On SIGNUP_RISK the+ # signup skips the WorkOS Radar verdict.EXEMPT = "exempt"diff --git a/products/security/backend/logic/decisions.py b/products/security/backend/logic/decisions.pyindex 0b1f8f8e59c0..ee71e3334eb9 100644--- a/products/security/backend/logic/decisions.py+++ b/products/security/backend/logic/decisions.py@@ -12,6 +12,7 @@ SCOPE_SURFACES: dict[str, frozenset[Surface]] = {"signup": frozenset({Surface.SIGNUP}),"ai_gateway": frozenset({Surface.AI_GATEWAY}),"email_code": frozenset({Surface.EMAIL_CODE}),+ "signup_risk": frozenset({Surface.SIGNUP_RISK}),}# The effect a rule needs to decide each surface.@@ -20,6 +21,7 @@ SURFACE_EFFECT: dict[Surface, str] = {Surface.APP: "block",Surface.AI_GATEWAY: "block",Surface.EMAIL_CODE: "exempt",+ Surface.SIGNUP_RISK: "exempt",}PROTECTED_DOMAIN = "posthog.com"diff --git a/products/security/backend/tests/fixtures/access-rules.json b/products/security/backend/tests/fixtures/access-rules.jsonindex 43a3a7597758..1cc1b12bb51d 100644--- a/products/security/backend/tests/fixtures/access-rules.json+++ b/products/security/backend/tests/fixtures/access-rules.json@@ -1,69 +1,78 @@{- "_format": "Shared matching contract. The canonical copy lives in the security hub repository at test-vectors/access-rules.json. The PostHog Django repository keeps a copy at products/security/backend/tests/fixtures/access-rules.json; change both together. Each case's expect string has one letter per surface in the order signup, app, ai_gateway, email_code: B = blocked, A = allowed (email_code: code required), E = exempt (email_code: code skipped). Rules are already normalized. The optional deciding map names the rule that must decide a surface.",+ "_format": "Shared matching contract. The canonical copy lives in the security hub repository at test-vectors/access-rules.json. The PostHog Django repository keeps a copy at products/security/backend/tests/fixtures/access-rules.json; change both together. Each case's expect string has one letter per surface in the order signup, app, ai_gateway, email_code, signup_risk: B = blocked, A = allowed (email_code: code required), E = exempt (email_code: code skipped; signup_risk: Radar skipped). Rules are already normalized. The optional deciding map names the rule that must decide a surface. The optional destinations list names the external systems a rule on its own belongs in (cloudflare, contour, workos), and a rule without the list belongs in none. It answers eligibility, not outcome: a stronger rule on the same target can still hold a listed rule back, so a range that is blocked is not also challenged for that same range, and an address that is blocked is not also allowed. A block on a posthog.com address or domain belongs in no destination, whatever its scope. Overlapping ranges are not resolved here, so a blocked /24 inside a challenged /16 reaches both lists.","suites": [{"name": "blocks and per-email exemptions","now": "2026-09-17T12:00:00Z","rules": [- {"id": "01920000-0000-7000-8000-000000000001", "targetType": "email_root", "targetValue": "[email protected]", "effect": "block", "scope": "all_access", "expiresAt": null},- {"id": "01920000-0000-7000-8000-000000000002", "targetType": "email_domain", "targetValue": "throwaway.example", "effect": "block", "scope": "all_access", "expiresAt": null},- {"id": "01920000-0000-7000-8000-000000000003", "targetType": "email_domain", "targetValue": "mailinator.com", "effect": "block", "scope": "signup", "expiresAt": null},+ {"id": "01920000-0000-7000-8000-000000000001", "targetType": "email_root", "targetValue": "[email protected]", "effect": "block", "scope": "all_access", "expiresAt": null, "destinations": []},+ {"id": "01920000-0000-7000-8000-000000000002", "targetType": "email_domain", "targetValue": "throwaway.example", "effect": "block", "scope": "all_access", "expiresAt": null, "destinations": ["workos"]},+ {"id": "01920000-0000-7000-8000-000000000003", "targetType": "email_domain", "targetValue": "mailinator.com", "effect": "block", "scope": "signup", "expiresAt": null, "destinations": ["workos"]},{"id": "01920000-0000-7000-8000-000000000004", "targetType": "organization_id", "targetValue": "1111aaaa-1111-4111-8111-11111111aaaa", "effect": "block", "scope": "ai_gateway", "expiresAt": null},{"id": "01920000-0000-7000-8000-000000000005", "targetType": "email_root", "targetValue": "[email protected]", "effect": "block", "scope": "ai_gateway", "expiresAt": null},- {"id": "01920000-0000-7000-8000-000000000006", "targetType": "ip", "targetValue": "93.184.216.0/24", "effect": "block", "scope": "all_access", "expiresAt": null},+ {"id": "01920000-0000-7000-8000-000000000006", "targetType": "ip", "targetValue": "93.184.216.0/24", "effect": "block", "scope": "all_access", "expiresAt": null, "destinations": ["cloudflare", "contour"]},{"id": "01920000-0000-7000-8000-000000000007", "targetType": "user_uuid", "targetValue": "2222abcd-2222-4222-8222-22222222abcd", "effect": "block", "scope": "all_access", "expiresAt": null},- {"id": "01920000-0000-7000-8000-000000000008", "targetType": "ip", "targetValue": "203.0.113.0/24", "effect": "block", "scope": "all_access", "expiresAt": "2026-09-01T00:00:00Z"},- {"id": "01920000-0000-7000-8000-000000000009", "targetType": "email_domain", "targetValue": "posthog.com", "effect": "block", "scope": "all_access", "expiresAt": null},+ {"id": "01920000-0000-7000-8000-000000000008", "targetType": "ip", "targetValue": "203.0.113.0/24", "effect": "block", "scope": "all_access", "expiresAt": "2026-09-01T00:00:00Z", "destinations": ["cloudflare", "contour"]},+ {"id": "01920000-0000-7000-8000-000000000009", "targetType": "email_domain", "targetValue": "posthog.com", "effect": "block", "scope": "all_access", "expiresAt": null, "destinations": []},{"id": "01920000-0000-7000-8000-000000000010", "targetType": "user_uuid", "targetValue": "3333abcd-3333-4333-8333-33333333abcd", "effect": "block", "scope": "all_access", "expiresAt": null},- {"id": "01920000-0000-7000-8000-000000000011", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "email_code", "expiresAt": null},+ {"id": "01920000-0000-7000-8000-000000000011", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "email_code", "expiresAt": null, "destinations": []},{"id": "01920000-0000-7000-8000-000000000012", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "email_code", "expiresAt": null},{"id": "01920000-0000-7000-8000-000000000013", "targetType": "everyone", "targetValue": "", "effect": "exempt", "scope": "email_code", "expiresAt": "2026-09-10T00:00:00Z"},{"id": "01920000-0000-7000-8000-000000000014", "targetType": "team_id", "targetValue": "42", "effect": "block", "scope": "ai_gateway", "expiresAt": null},{"id": "01920000-0000-7000-8000-000000000015", "targetType": "email", "targetValue": "[email protected]", "effect": "block", "scope": "future_scope", "expiresAt": null},{"id": "01920000-0000-7000-8000-000000000016", "targetType": "email", "targetValue": "[email protected]", "effect": "limit", "scope": "all_access", "expiresAt": null},- {"id": "01920000-0000-7000-8000-000000000017", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "all_access", "expiresAt": null}+ {"id": "01920000-0000-7000-8000-000000000017", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "all_access", "expiresAt": null},+ {"id": "01920000-0000-7000-8000-000000000018", "targetType": "ip", "targetValue": "198.18.0.0/24", "effect": "challenge", "scope": "all_access", "expiresAt": null, "destinations": ["cloudflare"]},+ {"id": "01920000-0000-7000-8000-000000000019", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "signup_risk", "expiresAt": null, "destinations": ["workos"]},+ {"id": "01920000-0000-7000-8000-000000000020", "targetType": "email_domain", "targetValue": "partner.example", "effect": "exempt", "scope": "signup_risk", "expiresAt": null, "destinations": ["workos"]},+ {"id": "01920000-0000-7000-8000-000000000021", "targetType": "email", "targetValue": "[email protected]", "effect": "block", "scope": "all_access", "expiresAt": null, "destinations": ["workos"]},+ {"id": "01920000-0000-7000-8000-000000000022", "targetType": "email", "targetValue": "[email protected]", "effect": "exempt", "scope": "signup_risk", "expiresAt": null, "destinations": ["workos"]}],"cases": [- {"name": "alias of an email root", "subject": {"email": "[email protected]"}, "expect": "BBBA"},- {"name": "upper-case alias of an email root", "subject": {"email": "[email protected]"}, "expect": "BBBA"},- {"name": "email root with spaces", "subject": {"email": " [email protected] "}, "expect": "BBBA"},- {"name": "dots matter outside gmail", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "different domain", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "cyrillic lookalike", "subject": {"email": "fа[email protected]"}, "expect": "AAAA"},- {"name": "member of a blocked organization", "subject": {"email": "[email protected]", "organizationIds": ["1111aaaa-1111-4111-8111-11111111aaaa"]}, "expect": "AABA"},- {"name": "member of a bystander organization", "subject": {"email": "[email protected]", "organizationIds": ["4444aaaa-4444-4444-8444-44444444aaaa"]}, "expect": "AAAA"},- {"name": "blocked organization by id", "subject": {"organizationIds": ["1111AAAA-1111-4111-8111-11111111AAAA"]}, "expect": "AABA"},- {"name": "bystander organization by id", "subject": {"organizationIds": ["4444aaaa-4444-4444-8444-44444444aaaa"]}, "expect": "AAAA"},- {"name": "blocked user by email and uuid", "subject": {"email": "[email protected]", "userUuid": "2222abcd-2222-4222-8222-22222222abcd"}, "expect": "BBBA"},- {"name": "blocked user by upper-case uuid", "subject": {"userUuid": "2222ABCD-2222-4222-8222-22222222ABCD"}, "expect": "BBBA"},- {"name": "gmail root through googlemail", "subject": {"email": "[email protected]"}, "expect": "AABA"},- {"name": "different gmail mailbox", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "subdomain of a blocked domain", "subject": {"email": "[email protected]"}, "expect": "BBBA"},- {"name": "blocked domain on its own", "subject": {"domain": "throwaway.example"}, "expect": "BBBA"},- {"name": "blocked domain inside another domain", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "shared suffix only", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "unrelated domain", "subject": {"domain": "example.com"}, "expect": "AAAA"},- {"name": "signup-only domain", "subject": {"email": "[email protected]"}, "expect": "BAAA"},- {"name": "first address of a blocked range", "subject": {"ip": "93.184.216.0"}, "expect": "BBBA"},- {"name": "last address of a blocked range", "subject": {"ip": "93.184.216.255"}, "expect": "BBBA"},- {"name": "mapped address in a blocked range", "subject": {"ip": "::ffff:93.184.216.34"}, "expect": "BBBA"},- {"name": "address after the range", "subject": {"ip": "93.184.217.0"}, "expect": "AAAA"},- {"name": "address before the range", "subject": {"ip": "93.184.215.255"}, "expect": "AAAA"},- {"name": "mapped address outside the range", "subject": {"ip": "::ffff:93.184.217.1"}, "expect": "AAAA"},- {"name": "loopback", "subject": {"ip": "127.0.0.1"}, "expect": "AAAA"},- {"name": "address in an expired rule's range", "subject": {"ip": "203.0.113.5"}, "expect": "AAAA"},- {"name": "unreadable address", "subject": {"ip": "not-an-ip"}, "expect": "AAAA"},- {"name": "empty subject", "subject": {}, "expect": "AAAA"},- {"name": "clean email from a blocked range", "subject": {"email": "[email protected]", "ip": "93.184.216.1"}, "expect": "BBBA"},- {"name": "oldest matching rule decides", "subject": {"email": "[email protected]", "ip": "93.184.216.1"}, "expect": "BBBA", "deciding": {"signup": "01920000-0000-7000-8000-000000000001", "ai_gateway": "01920000-0000-7000-8000-000000000001"}},- {"name": "posthog.com account with matching blocks and an exemption", "subject": {"email": "[email protected]", "userUuid": "3333abcd-3333-4333-8333-33333333abcd"}, "expect": "AAAE"},- {"name": "posthog.com alias", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "posthog.com subdomain", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "posthog.com account on a blocked range", "subject": {"email": "[email protected]", "ip": "93.184.216.10"}, "expect": "AAAE"},- {"name": "exempt email", "subject": {"email": "[email protected]"}, "expect": "AAAE"},- {"name": "exempt email in mixed case", "subject": {"email": "[email protected]"}, "expect": "AAAE"},- {"name": "alias of an exempt email", "subject": {"email": "[email protected]"}, "expect": "AAAA"},- {"name": "unknown type, scope and effect match nothing", "subject": {"email": "[email protected]"}, "expect": "AAAA"}+ {"name": "alias of an email root", "subject": {"email": "[email protected]"}, "expect": "BBBAA"},+ {"name": "upper-case alias of an email root", "subject": {"email": "[email protected]"}, "expect": "BBBAA"},+ {"name": "email root with spaces", "subject": {"email": " [email protected] "}, "expect": "BBBAA"},+ {"name": "dots matter outside gmail", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "different domain", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "cyrillic lookalike", "subject": {"email": "fа[email protected]"}, "expect": "AAAAA"},+ {"name": "member of a blocked organization", "subject": {"email": "[email protected]", "organizationIds": ["1111aaaa-1111-4111-8111-11111111aaaa"]}, "expect": "AABAA"},+ {"name": "member of a bystander organization", "subject": {"email": "[email protected]", "organizationIds": ["4444aaaa-4444-4444-8444-44444444aaaa"]}, "expect": "AAAAA"},+ {"name": "blocked organization by id", "subject": {"organizationIds": ["1111AAAA-1111-4111-8111-11111111AAAA"]}, "expect": "AABAA"},+ {"name": "bystander organization by id", "subject": {"organizationIds": ["4444aaaa-4444-4444-8444-44444444aaaa"]}, "expect": "AAAAA"},+ {"name": "blocked user by email and uuid", "subject": {"email": "[email protected]", "userUuid": "2222abcd-2222-4222-8222-22222222abcd"}, "expect": "BBBAA"},+ {"name": "blocked user by upper-case uuid", "subject": {"userUuid": "2222ABCD-2222-4222-8222-22222222ABCD"}, "expect": "BBBAA"},+ {"name": "gmail root through googlemail", "subject": {"email": "[email protected]"}, "expect": "AABAA"},+ {"name": "different gmail mailbox", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "subdomain of a blocked domain", "subject": {"email": "[email protected]"}, "expect": "BBBAA"},+ {"name": "blocked domain on its own", "subject": {"domain": "throwaway.example"}, "expect": "BBBAA"},+ {"name": "blocked domain inside another domain", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "shared suffix only", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "unrelated domain", "subject": {"domain": "example.com"}, "expect": "AAAAA"},+ {"name": "signup-only domain", "subject": {"email": "[email protected]"}, "expect": "BAAAA"},+ {"name": "first address of a blocked range", "subject": {"ip": "93.184.216.0"}, "expect": "BBBAA"},+ {"name": "last address of a blocked range", "subject": {"ip": "93.184.216.255"}, "expect": "BBBAA"},+ {"name": "mapped address in a blocked range", "subject": {"ip": "::ffff:93.184.216.34"}, "expect": "BBBAA"},+ {"name": "address after the range", "subject": {"ip": "93.184.217.0"}, "expect": "AAAAA"},+ {"name": "address before the range", "subject": {"ip": "93.184.215.255"}, "expect": "AAAAA"},+ {"name": "mapped address outside the range", "subject": {"ip": "::ffff:93.184.217.1"}, "expect": "AAAAA"},+ {"name": "loopback", "subject": {"ip": "127.0.0.1"}, "expect": "AAAAA"},+ {"name": "address in an expired rule's range", "subject": {"ip": "203.0.113.5"}, "expect": "AAAAA"},+ {"name": "unreadable address", "subject": {"ip": "not-an-ip"}, "expect": "AAAAA"},+ {"name": "empty subject", "subject": {}, "expect": "AAAAA"},+ {"name": "clean email from a blocked range", "subject": {"email": "[email protected]", "ip": "93.184.216.1"}, "expect": "BBBAA"},+ {"name": "oldest matching rule decides", "subject": {"email": "[email protected]", "ip": "93.184.216.1"}, "expect": "BBBAA", "deciding": {"signup": "01920000-0000-7000-8000-000000000001", "ai_gateway": "01920000-0000-7000-8000-000000000001"}},+ {"name": "posthog.com account with matching blocks and an exemption", "subject": {"email": "[email protected]", "userUuid": "3333abcd-3333-4333-8333-33333333abcd"}, "expect": "AAAEA"},+ {"name": "posthog.com alias", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "posthog.com subdomain", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "posthog.com account on a blocked range", "subject": {"email": "[email protected]", "ip": "93.184.216.10"}, "expect": "AAAEA"},+ {"name": "exempt email", "subject": {"email": "[email protected]"}, "expect": "AAAEA"},+ {"name": "exempt email in mixed case", "subject": {"email": "[email protected]"}, "expect": "AAAEA"},+ {"name": "alias of an exempt email", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "unknown type, scope and effect match nothing", "subject": {"email": "[email protected]"}, "expect": "AAAAA"},+ {"name": "challenged range is not blocked in Django", "subject": {"ip": "198.18.0.9"}, "expect": "AAAAA"},+ {"name": "signup risk exemption by email", "subject": {"email": "[email protected]"}, "expect": "AAAAE"},+ {"name": "signup risk exemption by domain covers subdomains", "subject": {"email": "[email protected]"}, "expect": "AAAAE"},+ {"name": "a signup risk exemption does not lift a block on the same address", "subject": {"email": "[email protected]"}, "expect": "BBBAE", "deciding": {"app": "01920000-0000-7000-8000-000000000021", "signup_risk": "01920000-0000-7000-8000-000000000022"}}]},{@@ -73,9 +82,9 @@{"id": "01920000-0000-7000-8000-000000000101", "targetType": "everyone", "targetValue": "", "effect": "exempt", "scope": "email_code", "expiresAt": "2026-09-20T00:00:00Z"}],"cases": [- {"name": "any email", "subject": {"email": "[email protected]"}, "expect": "AAAE"},- {"name": "empty subject", "subject": {}, "expect": "AAAE"},- {"name": "posthog.com account", "subject": {"email": "[email protected]"}, "expect": "AAAE"}+ {"name": "any email", "subject": {"email": "[email protected]"}, "expect": "AAAEA"},+ {"name": "empty subject", "subject": {}, "expect": "AAAEA"},+ {"name": "posthog.com account", "subject": {"email": "[email protected]"}, "expect": "AAAEA"}]}]diff --git a/products/security/backend/tests/test_decisions.py b/products/security/backend/tests/test_decisions.pyindex 100b790a2a39..1b319ff0d0be 100644--- a/products/security/backend/tests/test_decisions.py+++ b/products/security/backend/tests/test_decisions.py@@ -14,8 +14,8 @@ from products.security.backend.logic.rules import SnapshotRulefrom products.security.backend.logic.subjects import normalize_subjectVECTORS = json.loads((Path(__file__).parent / "fixtures" / "access-rules.json").read_text())-ORDER = [Surface.SIGNUP, Surface.APP, Surface.AI_GATEWAY, Surface.EMAIL_CODE]-LETTERS = {Surface.EMAIL_CODE: "E"}+ORDER = [Surface.SIGNUP, Surface.APP, Surface.AI_GATEWAY, Surface.EMAIL_CODE, Surface.SIGNUP_RISK]+LETTERS = {Surface.EMAIL_CODE: "E", Surface.SIGNUP_RISK: "E"}def _cases() -> list[tuple[str, dict[str, Any], dict[str, Any]]]:diff --git a/products/security/backend/tests/test_facade.py b/products/security/backend/tests/test_facade.pyindex e7793df33743..625090ac084a 100644--- a/products/security/backend/tests/test_facade.py+++ b/products/security/backend/tests/test_facade.py@@ -5,7 +5,7 @@ from prometheus_client import REGISTRYfrom posthog.models import User-from products.security.backend.facade.api import decide, is_email_code_exempt, shadow_check+from products.security.backend.facade.api import decide, is_email_code_exempt, is_signup_risk_exempt, shadow_checkfrom products.security.backend.facade.contracts import SubjectInputfrom products.security.backend.facade.enums import Outcome, Surfacefrom products.security.backend.tests.helpers import block_rule, exempt_rule, seed_rules@@ -39,6 +39,16 @@ class TestFacade(BaseTest):assert is_email_code_exempt("[email protected]") is Trueassert is_email_code_exempt("[email protected]") is False+ def test_signup_risk_exemption(self) -> None:+ seed_rules(exempt_rule(targetValue="[email protected]", scope="signup_risk"))+ assert is_signup_risk_exempt("[email protected]") is True+ assert is_email_code_exempt("[email protected]") is False+ assert is_signup_risk_exempt("[email protected]") is False++ def test_signup_risk_exemption_fails_closed(self) -> None:+ with patch("products.security.backend.facade.api.current_snapshot", side_effect=RuntimeError("boom")):+ assert is_signup_risk_exempt("[email protected]") is False+def test_email_code_exemption_fails_closed(self) -> None:with patch("products.security.backend.facade.api.current_snapshot", side_effect=RuntimeError("boom")):assert is_email_code_exempt("[email protected]") is False