From b257d71ae3167389089f4b2a697b731c45c21c85 Mon Sep 17 00:00:00 2001 From: Tben <52448020+BenjaminToby@users.noreply.github.com> Date: Tue, 9 May 2023 15:30:08 +0100 Subject: [PATCH] updates --- package.json | 2 +- users/logout-user.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c4253c7..817ebbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.1.1", + "version": "1.1.2", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": { diff --git a/users/logout-user.js b/users/logout-user.js index 539a389..a00133b 100644 --- a/users/logout-user.js +++ b/users/logout-user.js @@ -11,8 +11,10 @@ module.exports = function ({ request, response }) { * @description Check Encryption Keys */ try { - const authKeyName = request.cookies.filter((cookie) => cookie.match(/datasquirel_.*_auth_key/))[0]; - const csrfName = request.cookies.filter((cookie) => cookie.match(/datasquirel_.*_csrf/))[0]; + const cookiesKeys = Object.keys(request.cookies); + + const authKeyName = cookiesKeys.filter((cookieKey) => cookieKey.match(/datasquirel_.*_auth_key/))[0]; + const csrfName = cookiesKeys.filter((cookieKey) => cookieKey.match(/datasquirel_.*_csrf/))[0]; response.setHeader("Set-Cookie", [`${authKeyName}=null;samesite=strict;path=/;HttpOnly=true;Secure=true`, `${csrfName}=null;samesite=strict;path=/;HttpOnly=true`, `dsqluid=null;samesite=strict;path=/;HttpOnly=true`]);