From b4f991ab97c7cc3eaff1dfc4d2eccd5aa4c98571 Mon Sep 17 00:00:00 2001 From: Mirko Pira Date: Thu, 25 Apr 2024 11:19:59 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(jwt.js):=20fix=20issue=20with?= =?UTF-8?q?=20removing=20leading=20slash=20from=20keys=20in=20userDataNoNa?= =?UTF-8?q?mespace=20object=20The=20change=20in=20the=20code=20ensures=20t?= =?UTF-8?q?hat=20the=20leading=20slash=20is=20removed=20from=20the=20keys?= =?UTF-8?q?=20in=20the=20userDataNoNamespace=20object.=20This=20fix=20addr?= =?UTF-8?q?esses=20a=20bug=20where=20keys=20were=20not=20being=20processed?= =?UTF-8?q?=20correctly,=20leading=20to=20incorrect=20data=20manipulation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/jwt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jwt.js b/lib/jwt.js index 3d8e26e..89ebb55 100644 --- a/lib/jwt.js +++ b/lib/jwt.js @@ -19,7 +19,7 @@ module.exports = fp(async function (app, pluginOpts) { const userDataNoNamespace = {} for (const key of Object.keys(user)) { if (key.startsWith(namespace)) { - userDataNoNamespace[key.slice(namespace.length)] = user[key] + userDataNoNamespace[key.slice(namespace.length).replace(/^\//g, '')] = user[key] } else { userDataNoNamespace[key] = user[key] }