From 6ebe395c0b807c5bedd4a9130caf8d88bdb10968 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 1 Aug 2022 15:55:57 +0200 Subject: [PATCH] Add one sanity check at UI server incoming requests handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../ui-server/ui-services/AbstractUIService.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index a26af396..b2805ba6 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -35,6 +35,10 @@ export default abstract class AbstractUIService { } else { throw new BaseError('UI protocol request is not iterable'); } + // TODO: should probably be moved to the ws verify clients callback + if (protocolRequest.length !== 3) { + throw new BaseError('UI protocol request is malformed'); + } let messageResponse: JsonType; if (this.messageHandlers.has(command)) { try { -- 2.34.1