fix(backend): disable one-registration-per-IP by default

Shared NAT egress makes client IP unusable for uniqueness checks. Gate the
behavior behind REGISTRATION_ENFORCE_IP (default false) for public/invite signup.
This commit is contained in:
ahp
2026-10-07 23:13:22 +03:30
parent 92b1681241
commit 3cce2158e9
15 changed files with 103 additions and 53 deletions
+4
View File
@@ -46,6 +46,9 @@ type Config struct {
PhysicalCertEnabled bool
PhysicalCertPriceIRR int
PhysicalCertWindowDays int
// RegistrationEnforceIP limits one successful registration per client IP.
// Default false: behind NAT / shared egress the peer IP is not a real client identity.
RegistrationEnforceIP bool
}
func getEnv(key, fallback string) string {
@@ -140,6 +143,7 @@ func Load() *Config {
PhysicalCertEnabled: getEnv("PHYSICAL_CERT_ENABLED", "false") == "true",
PhysicalCertPriceIRR: getEnvInt("PHYSICAL_CERT_PRICE_IRR", 2_500_000),
PhysicalCertWindowDays: getEnvInt("PHYSICAL_CERT_WINDOW_DAYS", 30),
RegistrationEnforceIP: getEnv("REGISTRATION_ENFORCE_IP", "false") == "true",
}
}