feat(admission): add group VPN exceptions
CI / validate (push) Successful in 5m45s
Release / release (push) Successful in 7m21s

This commit is contained in:
dmg
2026-08-02 10:16:16 -04:00
parent 24808b0f8c
commit 71856bb869
34 changed files with 1820 additions and 138 deletions
+3 -1
View File
@@ -51,7 +51,9 @@ function numberValue(value: unknown) {
}
function proxyClassification(proxy: unknown, type: unknown): IpClassification {
if (String(proxy).toLowerCase() !== "yes") return "clear";
const normalizedProxy = String(proxy).toLowerCase();
if (normalizedProxy === "no") return "clear";
if (normalizedProxy !== "yes") return "unknown";
const normalizedType = String(type ?? "").toLowerCase();
if (normalizedType.includes("tor")) return "tor";
if (normalizedType.includes("vpn")) return "vpn";
+8
View File
@@ -50,6 +50,14 @@ describe("ProxyCheck.io intelligence", () => {
);
});
it("treats missing or malformed proxy signals as unknown", async () => {
for (const proxy of [undefined, null, "maybe"] as const) {
const request = vi.fn<typeof fetch>().mockResolvedValue(response({ proxy, type: "Residential" }));
await expect(new ProxyCheckProvider({ apiKey: "secret", request }).classify(ipAddress))
.resolves.toMatchObject({ classification: "unknown", network: { proxy: null } });
}
});
it("maps VPN and Tor responses to explicit classifications", async () => {
const vpnRequest = vi.fn<typeof fetch>().mockResolvedValue(response({ proxy: "yes", type: "VPN" }));
const torRequest = vi.fn<typeof fetch>().mockResolvedValue(response({ proxy: "yes", type: "TOR" }));