Update IP allowlist implementation

This commit is contained in:
Tuan Dang
2023-07-27 11:18:36 +07:00
parent 41c1828324
commit 221a43e8a4
2 changed files with 47 additions and 7 deletions
+3 -1
View File
@@ -26,6 +26,7 @@ import {
} from "../variables";
import { BotService } from "../services";
import { AuthData } from "../interfaces/middleware";
import { extractIPDetails } from "../utils/ip";
/**
* Validate authenticated clients for workspace with id [workspaceId] based
@@ -135,7 +136,8 @@ export const validateClientForWorkspace = async ({
}
}
const check = blockList.check(authData.authIP);
const { type } = extractIPDetails(authData.authIP);
const check = blockList.check(authData.authIP, type);
if (!check) throw UnauthorizedRequestError({
message: "Failed workspace authorization"