summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-12-26 11:01:21 +0100
committerRory& <root@rory.gay>2025-12-26 11:01:21 +0100
commit0c4d768bed5faac0ff785925bfffb3331bd249e1 (patch)
tree9e02b1af61786c2428872e3eaf84114f3cd3fcb6
parentFix endpoint public splitting (diff)
downloadserver-ts-0c4d768bed5faac0ff785925bfffb3331bd249e1.tar.xz
Ignore empty ASN type/ID in register
-rw-r--r--src/api/routes/auth/register.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/routes/auth/register.ts b/src/api/routes/auth/register.ts

index 3e3f2924..7da796eb 100644 --- a/src/api/routes/auth/register.ts +++ b/src/api/routes/auth/register.ts
@@ -155,14 +155,18 @@ router.post( throw new HTTPError("Your IP is blocked from registration"); } - if (register.blockAsnTypes.includes(ipData.asn.type)) { + if (ipData.asn.type && register.blockAsnTypes.includes(ipData.asn.type)) { console.log(`[Register] ${ip} blocked from registration: IPData.co ASN type ${ipData.asn.type} is blocked`); throw new HTTPError("Your IP is blocked from registration"); + } else if (!ipData.asn.type) { + console.log("[Register] IPData.co response missing asn.type field", ipData); } - if (register.blockAsns.includes(ipData.asn.asn)) { + if (ipData.asn.asn && register.blockAsns.includes(ipData.asn.asn)) { console.log(`[Register] ${ip} blocked from registration: IPData.co ASN ${ipData.asn.name} is blocked`); throw new HTTPError("Your IP is blocked from registration"); + } else if (!ipData.asn.asn) { + console.log("[Register] IPData.co response missing asn.asn field", ipData); } } }