From: Jérôme Benoit Date: Mon, 1 Aug 2022 13:55:57 +0000 (+0200) Subject: Add one sanity check at UI server incoming requests handling X-Git-Tag: v1.1.65~24 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6ebe395c0b807c5bedd4a9130caf8d88bdb10968;p=e-mobility-charging-stations-simulator.git Add one sanity check at UI server incoming requests handling Signed-off-by: Jérôme Benoit --- 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 {