Skip to content

Commit a32f485

Browse files
authored
Merge pull request #2011 from cprussin/allow-icloud
feat(staking): allow icloud public relay
2 parents b533d40 + 97c0bfe commit a32f485

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

apps/staking/src/config/server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export const MAINNET_RPC = process.env.MAINNET_RPC;
5555
export const HERMES_URL = getOr("HERMES_URL", "https://hermes.pyth.network");
5656
export const BLOCKED_REGIONS = transformOr("BLOCKED_REGIONS", fromCsv, []);
5757
export const IP_ALLOWLIST = transformOr("IP_ALLOWLIST", fromCsv, []);
58+
export const VPN_ORGANIZATION_ALLOWLIST = transformOr(
59+
"VPN_ORGANIZATION_ALLOWLIST",
60+
fromCsv,
61+
["iCloud Private Relay"],
62+
);
5863
export const GOVERNANCE_ONLY_REGIONS = transformOr(
5964
"GOVERNANCE_ONLY_REGIONS",
6065
fromCsv,

apps/staking/src/middleware.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
GOVERNANCE_ONLY_REGIONS,
1313
PROXYCHECK_API_KEY,
1414
IP_ALLOWLIST,
15+
VPN_ORGANIZATION_ALLOWLIST,
1516
} from "./config/server";
1617

1718
const GEO_BLOCKED_PATH = `/${GEO_BLOCKED_SEGMENT}`;
@@ -61,8 +62,13 @@ const isProxyBlocked = async ({ ip }: NextRequest) => {
6162
if (proxyCheckClient === undefined || ip === undefined) {
6263
return false;
6364
} else {
64-
const result = await proxyCheckClient.checkIP(ip, { vpn: 2 });
65-
return result[ip]?.proxy === "yes";
65+
const response = await proxyCheckClient.checkIP(ip, { vpn: 2 });
66+
const result = response[ip];
67+
return (
68+
result &&
69+
result.proxy === "yes" &&
70+
!VPN_ORGANIZATION_ALLOWLIST.includes(result.organisation)
71+
);
6672
}
6773
};
6874

0 commit comments

Comments
 (0)