fix vulnerability (#5098)

* safe

* add get cookie

* fix

* fix

* fix
This commit is contained in:
heheer
2025-06-27 14:35:38 +08:00
committed by GitHub
parent 1cc86f9eb7
commit b6a258d494
9 changed files with 101 additions and 22 deletions
+3 -4
View File
@@ -83,12 +83,11 @@ const getSession = async (key: string): Promise<SessionType> => {
return Promise.reject(ERROR_ENUM.unAuthorization);
}
};
export const delUserAllSession = async (userId: string, whileList?: string[]) => {
const formatWhileList = whileList?.map((item) => getSessionKey(item));
export const delUserAllSession = async (userId: string, whiteList?: (string | undefined)[]) => {
const formatWhiteList = whiteList?.map((item) => item && getSessionKey(item));
const redis = getGlobalRedisConnection();
const keys = (await getAllKeysByPrefix(`${redisPrefix}${userId}`)).filter(
(item) => !formatWhileList?.includes(item)
(item) => !formatWhiteList?.includes(item)
);
if (keys.length > 0) {