From f5bbcdecd935fe362a939e620e1ec3f98560b424 Mon Sep 17 00:00:00 2001 From: dzdidi Date: Fri, 26 Jan 2024 08:34:52 +0000 Subject: [PATCH] handle missing header Signed-off-by: dzdidi --- src/rpc.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpc.js b/src/rpc.js index e872d8e..9cb8ce0 100755 --- a/src/rpc.js +++ b/src/rpc.js @@ -107,6 +107,8 @@ module.exports = class RPC { url: request.body.url } if (process.env.GIT_PEAR_AUTH) { + if (!request.header) throw new Error('You are not allowed to access this repo') + payload = await acl.getId({ ...request.body, payload: request.header @@ -115,7 +117,7 @@ module.exports = class RPC { // check if payload.userId is presenet there const aclList = home.getACL(result.repoName) if (!aclList.includes(payload.userId)) { - throw new Error(`You are not allowed to access this repo: ${payload.userId}`) + throw new Error('You are not allowed to access this repo') } }