From 7cd3573c3f9d0da25c0b19b253dc40e19db41905 Mon Sep 17 00:00:00 2001 From: Alex4386 Date: Sat, 12 Feb 2022 17:35:36 +0900 Subject: [PATCH 1/2] chore: invalid body handling --- src/routes/v1/admin/users/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/v1/admin/users/index.ts b/src/routes/v1/admin/users/index.ts index 2899f509..e5fc8b44 100644 --- a/src/routes/v1/admin/users/index.ts +++ b/src/routes/v1/admin/users/index.ts @@ -105,7 +105,10 @@ const usersAdminHandler = (app: FastifyInstance, opts: FastifyPluginOptions, don // TODO: add endpoints to allow CRUD operations on user's authentication method by admin const data = req.body as any; - const hasRequirementsMet = Utils.isNotBlank(data, data.username); + if (!data) + return Meiling.V1.Error.sendMeilingError(rep, Meiling.V1.Error.ErrorType.INVALID_REQUEST, 'Invalid Body'); + + const hasRequirementsMet = Utils.isNotBlank(data.username); if (!hasRequirementsMet) return Meiling.V1.Error.sendMeilingError(rep, Meiling.V1.Error.ErrorType.INVALID_REQUEST, 'Invalid Username'); From a7887fc796ea4693abe77eeb7a98220b071a1100 Mon Sep 17 00:00:00 2001 From: Alex4386 Date: Sat, 12 Feb 2022 17:35:50 +0900 Subject: [PATCH 2/2] chore: bump up version to 0.8.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ded2bac..2e4b9422 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meiling", - "version": "0.8.1", + "version": "0.8.3", "description": "An easy-to-use, open-source, flexible oAuth2 Authentication Provider and OpenID Connect Server", "main": "dist/", "repository": "https://github.com/meiling-gatekeeper/meiling",