Skip to content

Commit 2299c6f

Browse files
committed
fix: remove overly broad ipinfo keywords causing false positives
1 parent 6597707 commit 2299c6f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

routes/auth.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ async function isVpnOrProxy(ip) {
119119
try {
120120
const res = await fetchWithTimeout(`https://ipinfo.io/${cleanIp}/json`);
121121
const data = await res.json();
122-
console.log('[VPN] ipinfo response for', cleanIp, ':', JSON.stringify({ org: data.org, hosting: data.hosting }));
123-
if (data.org && (data.org.startsWith('AS') || data.org.toLowerCase().includes('vpn') ||
124-
data.org.toLowerCase().includes('proxy') || data.org.toLowerCase().includes('hosting'))) {
122+
console.log('[VPN] ipinfo response for', cleanIp, ':', JSON.stringify({ org: data.org }));
123+
const orgLower = (data.org || '').toLowerCase();
124+
if (orgLower.includes('vpn') || orgLower.includes('proxy') || orgLower.includes('tor') ||
125+
orgLower.includes('hosting') || orgLower.includes('cloud') || orgLower.includes('datacenter')) {
125126
return true;
126127
}
127128
} catch (err) {

0 commit comments

Comments
 (0)